Macro for Grouping Rows

ShanaVT

Board Regular
Joined
May 12, 2010
Messages
86
Hello! I have about 10,000 rows of data that I need grouped based on certain criteria and I am trying to figure out a way to group them without doing it manually. Below is the sample data and the groupings I am trying to achieve. Any help is much appreciated! Thanks!!!

Total Data
[TABLE="width: 263"]
<tbody>[TR]
[TD]CRN_111111 ABC Program
[/TD]
[/TR]
[TR]
[TD]CRN_222222 DEF Program
[/TD]
[/TR]
[TR]
[TD]CRN_333333 GHI Program
[/TD]
[/TR]
[TR]
[TD]862_0069_0004 Alpha Programs - Group 1
[/TD]
[/TR]
[TR]
[TD]CRN_444444 JKL Program
[/TD]
[/TR]
[TR]
[TD]CRN_555555 MNO Program
[/TD]
[/TR]
[TR]
[TD]862_0069_0001 Alpha Programs - Group 2
[/TD]
[/TR]
[TR]
[TD]CRN_666666 PQR Program
[/TD]
[/TR]
[TR]
[TD]862_0069_0058 Alpha Programs - Group 3
[/TD]
[/TR]
[TR]
[TD]862_0069 Alpha Programs
[/TD]
[/TR]
[TR]
[TD]CRN_111111 ABC Program
[/TD]
[/TR]
[TR]
[TD]CRN_222222 DEF Program
[/TD]
[/TR]
[TR]
[TD]CRN_333333 GHI Program
[/TD]
[/TR]
[TR]
[TD]862_0070_0006 Beta Programs - Group 1
[/TD]
[/TR]
[TR]
[TD]CRN_444444 JKL Program
[/TD]
[/TR]
[TR]
[TD]CRN_555555 MNO Program
[/TD]
[/TR]
[TR]
[TD]862_0070_0020 Beta Programs - Group 2
[/TD]
[/TR]
[TR]
[TD]CRN_666666 PQR Program
[/TD]
[/TR]
[TR]
[TD]862_0070_0058 Beta Programs - Group 3
[/TD]
[/TR]
[TR]
[TD]
862_0070 Beta Programs
862 Contracts

Level 1 Grouping:
862 Contracts

Level 2 Grouping
[TABLE="width: 263"]
<tbody>[TR]
[TD]862_0069 Alpha Programs
[/TD]
[/TR]
[TR]
[TD]862_0070 Beta Programs
862 Contracts
[/TD]
[/TR]
</tbody>[/TABLE]

Level 3 Grouping
[TABLE="width: 263"]
<tbody>[TR]
[TD]862_0069_0004 Alpha Programs - Group 1
[/TD]
[/TR]
[TR]
[TD]862_0069_0001 Alpha Programs - Group 2
[/TD]
[/TR]
[TR]
[TD]862_0069_0058 Alpha Programs - Group 3
[/TD]
[/TR]
[TR]
[TD]862_0069 Alpha Programs
[/TD]
[/TR]
[TR]
[TD]862_0070_0006 Beta Programs - Group 1
[/TD]
[/TR]
[TR]
[TD]862_0070_0020 Beta Programs - Group 2
[/TD]
[/TR]
[TR]
[TD]862_0070_0058 Beta Programs - Group 3
[/TD]
[/TR]
[TR]
[TD]862_0070 Beta Programs
[/TD]
[/TR]
</tbody>[/TABLE]
862 Contracts
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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