Vlookup help for comma separated values

rik81h

New Member
Joined
Mar 29, 2024
Messages
11
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

New member here, relative novice in terms of excel usage.
I have a workbook i'm trying to put together with monthly worksheets containing date ranges. I have an extra worksheet with some data in, just 2 columns which contain a "job code" A-G with a description for each in the next column.

I want to be able to enter a code in the worksheets and it autofil the next column with the description. A friend helped me with this giving me a vlookup formula =IFERROR(VLOOKUP(B2,Descriptions!$A$2:$C$10,2,FALSE),"") however this does not work with multiple comma separated code values. I need to be able to enter A, C for example or maybe even 3 or more in to one cell.

Any help would be appreciated, TIA.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Do you want to enter into B2 more than 1 value like A, C and expect result like: Description 1, Description 2 etc.
Am I correct?
 
Upvote 0
Try like this:

Book1
BCDEF
2ADescription AA, C, EDescription A, Description C, Description E
3BDescription BB, EDescription B, Description E
4CDescription C
5DDescription D
6EDescription E
Sheet1
Cell Formulas
RangeFormula
F2:F3F2=TEXTJOIN(", ",1,VLOOKUP(TRANSPOSE(FILTERXML("<t><s>" & SUBSTITUTE(E2,",","</s><s>") & "</s></t>", "//s")),$B:$C,2,0))


as I read TRANSPOSE works in Excel 2019 as array formula, so you have to accept it with Ctrl+Shift+Enter.
 
Upvote 1
Try like this:

Book1
BCDEF
2ADescription AA, C, EDescription A, Description C, Description E
3BDescription BB, EDescription B, Description E
4CDescription C
5DDescription D
6EDescription E
Sheet1
Cell Formulas
RangeFormula
F2:F3F2=TEXTJOIN(", ",1,VLOOKUP(TRANSPOSE(FILTERXML("<t><s>" & SUBSTITUTE(E2,",","</s><s>") & "</s></t>", "//s")),$B:$C,2,0))


as I read TRANSPOSE works in Excel 2019 as array formula, so you have to accept it with Ctrl+Shift+Enter.
Thank you kokosek so that works as i need in your example but when i plug in my source it only shows the 1 returned answer using =TEXTJOIN(", ",1,VLOOKUP(TRANSPOSE(FILTERXML("<t><s>" & SUBSTITUTE(B29,",","</s><s>") & "</s></t>", "//s")),Descriptions!$A$2:$B$8,2,0))
 
Upvote 0
Ok so no problem with accepting it and i have those added braces but the forumla still only returns 1 result even when i do not adjust the table array. :(
 
Upvote 0
I've just re-created your example exactly in a new workbook and I get the same results as in my own workbook, it is only returning the first entry. Perhaps some limitation or functionality change within 2019? And yes that is with ctrl shift entr to accept as an array. :/
 
Upvote 0
I don't have your version to test but what happens if you use this formula, entered normally?

rik81h.xlsm
AB
1
2ADescription A
3BDescription B
4CDescription C
5DDescription D
6EDescription E
7
8
Descriptions


Cell Formulas
RangeFormula
C29:C31C29=TEXTJOIN(", ",1,VLOOKUP(FILTERXML("<t><s>" & SUBSTITUTE(B29,",","</s><s>") & "</s></t>", "//s"),Descriptions!A$2:B$8,2,0))
 
Upvote 1
Solution

Forum statistics

Threads
1,224,811
Messages
6,181,082
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