Group by SSN?

sandersen

New Member
Joined
Jun 1, 2010
Messages
37
Anyone, I have a large spreadsheet of SSN's in Column A where some SSN's are in multiple rows. I have sorted by SSN but now I would like to have the Rows Grouped and Outlined by the SSN's in Column A. I would like use a MACRO to complete this task. Please help if you can. Thanks again in advance.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
If you have a group of say 3 SSN's together, which of the 3 would you want demoted?
 
Upvote 0
It'd be something like this:
Code:
   For Each c In Range("A2", Range("A65536").End(xlUp))
        If c.Value = c.Offset(-1, 0).Value Then
            c.EntireRow.Group
        End If
    Next
 
Upvote 0
That work perfectly thanks! I have one more request if you don't mind. Is there a way to highlight every other group a color?
 
Upvote 0
You could use conditional formatting ... like this ... condition of formula is:

=MOD(ROUND(SUM(1/COUNTIF($A$2:A2,$A$2:A2)),0),2)=1

assuming that the selected region starts in cell A2. Adjust all references ( but maintain the pattern of the $ signs ) if you are selecting a different area for your formatting.
 
Upvote 0
Again that works great, one last question and I will call this one good. I am having difficulty manipulating that last formula to highlight everyother field when the range of data I have is in columns A thru Z. Any suggestions?
 
Upvote 0
Select A2:Z999 ( or whatever ), and use this formula:

=MOD(ROUND(SUM(1/COUNTIF($A$2:$A2,$A$2:$A2)),0),2)=1
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,210
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top