Generate lists from array

schris

New Member
Joined
Apr 2, 2018
Messages
2
Hi, new user here who's not bad at Excel, but doesn't have a lot of experience with arrays. My problem:

Given a list of groups (in this example types of fruit) and membership in each group (names), I'd like to generate a rows where each person's group memberships are listed.

ABCDE
1
Name1Name2Name3Name4
2Apple
Paul
3BananaGregGeorgeJeffEd
4OrangeRonPaulGreg
5GrapeChrisEdPaul
6
7Output:
8Chris
Grape
9EdBananaGrape
10GeorgeBanana
11GregBananaOrange
12PaulAppleOrangeGrape
13RonOrange
14JeffBanana

<tbody>
</tbody>


I've tried variations of array, INDEX, MATCH and SMALL, but have had no luck. I'm starting to wonder if this is even possible with Excel.

Frustrated fruit vendor,
Steve
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Welcome to the Board.

Try:

ABCDE
1Name1Name2Name3Name4
2ApplePaul
3BananaGregGeorgeJeffEd
4OrangeRonPaulGreg
5GrapeChrisEdPaul
6
7Output:
8ChrisGrape
9EdBananaGrape
10GeorgeBanana
11GregBananaOrange
12PaulAppleOrangeGrape
13RonOrange
14JeffBanana

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet8

Array Formulas
CellFormula
B8{=IFERROR(INDEX($A$2:$A$5,SMALL(IF($B$2:$E$5=$A8,ROW($A$2:$A$5)-ROW($A$2)+1),COLUMNS($B8:B8))),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Holy cow Eric, it works! Thank you so much, I can't believe how fast you whipped that up, I've been struggling with it for hours.

Very much appreciated!
Steve
 
Upvote 0
If you do need/want to extract the names in alphabetical order maybe something like this


A
B
C
D
E
1
Name1​
Name2​
Name3​
Name4​
2
Apple​
Paul​
3
Banana​
Greg​
George​
Jeff​
Ed​
4
Orange​
Ron​
Paul​
Greg​
5
Grape​
Chris​
Ed​
Paul​
6
7
Output:​
8
Chris​
Grape​
9
Ed​
Banana​
Grape​
10
George​
Banana​
11
Greg​
Banana​
Orange​
12
Jeff​
Banana​
13
Paul​
Apple​
Orange​
Grape​
14
Ron​
Orange​
15

<tbody>
</tbody>


Array formula in A8 copied down (gray area)
=IFERROR(INDIRECT(TEXT(SMALL(IFERROR(IF(IF(B$2:E$5<>"",COUNTIF(B$2:E$5,"<"&B$2:E$5)+1,"")-SUM(COUNTIF(A$7:A7,B$2:E$5))=1,ROW(B$2:E$5)*10^5+COLUMN(B$2:E$5)),""),1),"L0C00000"),0),"")
Ctrl+Shift+Enter

M.
 
Last edited:
Upvote 0
Well, it really helps if you've seen something like it before! :biggrin:

Glad we could help!
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,196
Latest member
Maxkapoor

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