LOOKUP for each comma delimited item

FlashDota

New Member
Joined
Jun 11, 2023
Messages
33
Office Version
  1. 2021
Platform
  1. Windows
I want to achieve the following results, How can I do this without VBA, only formulas?





Output:
ActorMovieResult ActorDesired Result Movies
Actor 1, Actor 2, Actor 3OppenheimerActor 1Oppenheimer, Barbie
Actor 1BarbieActor 2Oppenheimer, Spiderman
Actor 2SpidermanActor 3Oppenheimer
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I noticed you have 2021 Excel version. By chance have you upgraded to 365? Here is a solution using newer Excel functions assuming your values are in A2:B4...

Excel Formula:
=LET(
actors,A2:A4,
movies,B2:B4,
a, LET(allActorsMovies,LET(finalVal,IFNA(TOCOL(TEXTSPLIT(CONCAT(actors&"-"),", ","-")&"_"&movies),""),FILTER(finalVal,finalVal<>"")),CHOOSE({1,2},TEXTBEFORE(allActorsMovies,"_"),TEXTAFTER(allActorsMovies,"_"))),
b, CHOOSECOLS(a,1),
c, UNIQUE(b),
d, MAP(c, LAMBDA(x, TEXTJOIN(", ",,FILTER(CHOOSECOLS(a, 2),b=x)))),
e, HSTACK(c, d),
e
)
 
Upvote 0
I noticed you have 2021 Excel version. By chance have you upgraded to 365? Here is a solution using newer Excel functions assuming your values are in A2:B4...

Excel Formula:
=LET(
actors,A2:A4,
movies,B2:B4,
a, LET(allActorsMovies,LET(finalVal,IFNA(TOCOL(TEXTSPLIT(CONCAT(actors&"-"),", ","-")&"_"&movies),""),FILTER(finalVal,finalVal<>"")),CHOOSE({1,2},TEXTBEFORE(allActorsMovies,"_"),TEXTAFTER(allActorsMovies,"_"))),
b, CHOOSECOLS(a,1),
c, UNIQUE(b),
d, MAP(c, LAMBDA(x, TEXTJOIN(", ",,FILTER(CHOOSECOLS(a, 2),b=x)))),
e, HSTACK(c, d),
e
)
Thanks for the answer. Nope, still Office 2021. This is returning a #NAME? error
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,098
Members
453,021
Latest member
Justyna P

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