Sort list into separate columns

Guentjo

Active Member
Joined
Jul 27, 2004
Messages
347
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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Guentjo

Active Member
Joined
Jul 27, 2004
Messages
347
I like it. It's genius!

Thanks. My own step 2 is learning why it works.
 

Guentjo

Active Member
Joined
Jul 27, 2004
Messages
347
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?
 

Krishnakumar

Well-known Member
Joined
Feb 28, 2003
Messages
2,615
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
 

Forum statistics

Threads
1,148,397
Messages
5,746,460
Members
424,021
Latest member
naimathulla

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
Top