Sort list into separate columns

Guentjo

Active Member
Joined
Jul 27, 2004
Messages
351
Office Version
  1. 2021
Platform
  1. Windows
I have a need to recreate a databse output in excel. Simply, I have a list of Names, each name can be assigned to a specific group number (1 through 3). I then have 3 columns, one for each group that will contain the appropriate list. The group assignments change frequently, so I'd like to automate the process. Is there a formula or macro that will do this easily. I have attached an example of how it could look (i've hard coded the names in columns D,E,&F). I have a feeling there is a basic solution to this that I just don't know (don't say "use Access")
Book1
ABCDEF
2GroupNameGroup1Group2Group3
31SusanChrisEmilyJohn
41SteveSteveMarkSara
53SaraSusanChristyIrwin
62Mark
73John
83Irwin
92Emily
102Christy
111Chris
Sheet1
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I like it. It's genius!

Thanks. My own step 2 is learning why it works.
 
Upvote 0
I'm having a problem with the array. It only works if the array starts in row 2. If I insert a row above, or cut and paste the array to a new location, the formula fails. The reference all appear to still be valid, but the output is wrong.

What am I missing?
 
Upvote 0
Hi,

=IF(ROW()-ROW(E$1)>COUNTIF($A$2:$A$10,E$1),"",INDEX($B$1:$B$10,SMALL(IF($A$2:$A$10=E$1,ROW($B$2:$B$10)),ROW()-ROW(E$1))))

Change the bold part with ROW($A2).

HTH
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,438
Members
448,897
Latest member
dukenia71

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