View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default grouping rows with blank cells

Emmweb wrote...
I have a worksheet with data like:
Name ID Attribute
Attribute
Name ID Attribute
Attribute
Attribute
Name ID Attribute

Each Name and ID can have multiple attributes (lines), up to about 20 lines
per person. Only the first line for each person shows the Name and ID.

Is there an easy way to "group" the lines together in such a way that I
could sort on Name or ID and not lose the Attributes (in the correct order)
that go with them?


The easiest way to sort such tables is to use an additional column of
formulas as the sort key. If your table above were in A1:C6, enter the
following formulas.

D1:
=A1&TEXT(ROW(),"\.00000")

D2:
=IF(A2<"",A2&TEXT(ROW(),"\.00000"),SUBSTITUTE(D1, ROW()-1,ROW()))

Fill D2 down as needed. Sort on column D to sort the table by name.
Replace col A references with col B references to sort by ID.