Sort based on column values then repeat

jrf1111

New Member
Joined
Feb 24, 2016
Messages
4
Hi all, I have a worksheet that looks something like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Person#[/TD]
[TD]Stuff #[/TD]
[TD]Data[/TD]
[/TR]
[TR]
[TD]Person1[/TD]
[TD]1[/TD]
[TD]Person1 stuff 1[/TD]
[/TR]
[TR]
[TD]Person1[/TD]
[TD]2[/TD]
[TD]Person1 stuff 2 [/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]2[/TD]
[TD]Person2 stuff 2[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]4[/TD]
[TD]Person2 stuff 4 [/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]3[/TD]
[TD]Person2 stuff 3 [/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]1[/TD]
[TD]Person2 stuff 1 [/TD]
[/TR]
[TR]
[TD]Person3[/TD]
[TD]2[/TD]
[TD]Person3 stuff 2 [/TD]
[/TR]
[TR]
[TD]Person3[/TD]
[TD]1[/TD]
[TD]Person3 stuff 1[/TD]
[/TR]
</tbody>[/TABLE]

For some reason Excel won't sort first by Col A (Person #) then by Col B (Stuff #) so it will look like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Person#[/TD]
[TD]Stuff #[/TD]
[TD]Data[/TD]
[/TR]
[TR]
[TD]Person1[/TD]
[TD]1[/TD]
[TD]Person1 stuff 1[/TD]
[/TR]
[TR]
[TD]Person1[/TD]
[TD]2[/TD]
[TD]Person1 stuff 2[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]1[/TD]
[TD]Person2 stuff 1[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]2[/TD]
[TD]Person2 stuff 2 [/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]3[/TD]
[TD]Person2 stuff 3 [/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]4[/TD]
[TD]Person2 stuff 4[/TD]
[/TR]
[TR]
[TD]Person3[/TD]
[TD]1[/TD]
[TD]Person3 stuff 1[/TD]
[/TR]
[TR]
[TD]Person3[/TD]
[TD]2[/TD]
[TD]Person3 stuff 2[/TD]
[/TR]
</tbody>[/TABLE]


Is there someway to do this in VBA? Thanks in advance.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
It gave me something like this
[TABLE="width: 500"]
<tbody>[TR]
[TD]Person#[/TD]
[TD]Stuff#[/TD]
[/TR]
[TR]
[TD]Person1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Person3[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Person1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Person3[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Person2[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
you could try going to DATA, click on SORT...sort by...Stuff #.....add a level....then by...Person #....both sorted on values...Order....smallest to largest and A To Z
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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