Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split cell text by delimeter and perform vlookup on each

I have cells that contain text seperated by commas such as:

apples, bananas, mango

The number of items in each cell vary, some have one, some have as many as 10.

I'm looking to loop through each item in the cell and then perform a vlookup on them, I'd quite like the vlookup result to be put into the same format in the resulting cell. So for example if there are matches from multiple items in my original cell, the resulting cell will contain multiple results separated by a comma.

I think ill be fine with the vlookup logic but really struggling to have a sort of "for loop" to go through all items in my list separated by the comma.

like image 923
Ed Jones Avatar asked Oct 20 '25 17:10

Ed Jones


1 Answers

Using Formula currently Available in Office 365 and Excel 2019 for PC:

=TEXTJOIN(", ",TRUE,IFERROR(VLOOKUP(FILTERXML("<a><b>"&SUBSTITUTE(A1,",","</b><b>")&"</b></a>","//b"),F1:G3,2,0),""))

enter image description here

Using Functions that are currently only available to Office Insiders beta channel:

=TEXTJOIN(", ",TRUE,XLOOKUP(TEXTSPLIT(A1,", "),F1:F3,G1:G3,""))
like image 180
Scott Craner Avatar answered Oct 23 '25 06:10

Scott Craner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!