Help with sorting data

  • Thread starter Thread starter Rex
  • Start date Start date
R

Rex

I have a spreadsheet with 26 columns of info that’s approx. 1000 rows long.
I need to sort by column L and then Column I. When done sorting I will have
multiple names (different every report) in column L and multiple medical
conditions (different every time) in column I. The goal is to keep one row
of each name matched with one entry of each medical condition (sorted for
that name) and hide all the other rows.

Daffy Duck may have 15 entries with a broken elbow and 13 entries with the
flu. I only want one row of each condition associated with Daffy Duck to
appear (it doesn't matter which row) and the rest of the rows would be
hidden. This would continue thru all the names and conditions. Anyone have
any macro suggestions? I use Excel 2003.
 
I have a spreadsheet with 26 columns of info that’s approx. 1000 rows long.  
I need to sort by column L and then Column I.  When done sorting I willhave
multiple names (different every report) in column L and multiple medical
conditions (different every time) in column I.  The goal is to keep onerow
of each name matched with one entry of each medical condition (sorted for
that name) and hide all the other rows.  

Daffy Duck may have 15 entries with a broken elbow and 13 entries with the
flu.  I only want one row of each condition associated with Daffy Duck to
appear (it doesn't matter which row) and the rest of the rows would be
hidden.  This would continue thru all the names and conditions.  Anyone have
any macro suggestions?  I use Excel 2003.

Best is to use pivottable.which will sort and return the unique.
 
Best is to use pivottable.which will sort and return the unique.

something like this

Option Explicit

Sub m()
Dim c As Range
Dim rng As Range
Set rng = Range("I1:I1000")
For Each c In rng
If c = c.Offset(1) And c.Offset(, 4) = c.Offset(1, 4) Then c.RowHeight
= 0
Next c
End Sub
 
Back
Top