View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Extracting multiple entries in a cell into their component pie

On Mon, 19 Jun 2006 05:04:02 -0700, Bob wrote:

Herbert,
Yes, our assumptions are somewhat different. Each cell in column A may have
a different number of entries. Whereas you assume each cell has the same
number of entires (i.e., 4). Otherwise, we are in sync with everything else
you mentioned.
Is there a way to modify your formula to reflect my assumption?
Thanks again for all your help.
Bob


Bob,

You realize that the solution of this problem would be trivial and quick using
a VBA macro.

For example:

=================================
Option Explicit

Sub SplitData()
Dim src As Range
Dim dest As Range
Dim i As Long, j As Long
Dim SplitArray As Variant

Set dest = [B1]
i = 0: j = 0

For Each src In Selection
SplitArray = Split(src, ",")
For i = 0 To UBound(SplitArray)
dest.Offset(i + j, 0).Value = Trim(SplitArray(i))
Next i
j = j + UBound(SplitArray) + 1
Next src
End Sub
============================

allows you to select the range of cells you wish to split up, and generates a
single column list of all the contents of all the cells in "Selection".

This can be modified so you could only select one cell in the column; or
hard-code it; or ...

Then, instead of multiple steps, you just execute this macro and you're done.


--ron