How to use VLOOKUP if lookup values are comma separated in a single cell?

svidmar

New Member
Joined
May 28, 2018
Messages
1
Hi

I have a question that I can't seem to find a working solution for

In sheet #1 I have a list of ISSN numbers in Column A:

A
1ISSN
20904-3535
30941-4355, 1433-7339
42076-0787

<tbody>
</tbody>

And in sheet #2 I have the following in columns A and B:

AB
1ISSNURL
20904-3535www.example.com
31433-7339www.example1.com
42076-0787www.example2.com

<tbody>
</tbody>

Task: I need to create a list of URLs in sheet#1 based on ISSN numbers.

I use the VLOOKUP function to look in sheet #2 after the URL's to the corresponding ISSN number. It works fine, when there is only one value in each cell in column A (sheet #1 ) . The problem arises when there are several values in the same cell, separated by a comma (cell A3). The value AFTER the comma is being ignored by the function. I can't figure out how to, as an example, have the VLOOKUP function return "www.example1.com' based on the ISSN '1433-7339', because the value is after the comma in the cell.

I'm "not allowed" to alter the column with the comma separated values, so it's not an option to split the column.

Any ideas on how to do this? Should I use another function, in stead of VLOOKUP?

Any help would be greatly appreciated
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I can't test it but what about
Code:
 =[URL="https://exceljet.net/excel-functions/excel-vlookup-function"]VLOOKUP[/URL]("*"&$H$2&"*",$A$2:$B$4,2,FALSE)
where H2 is value you are looking for?
 
Last edited:
Upvote 0
In B2 of Sheet1 control+shift+enter, not just enter, copy across, and down:

=IFERROR(INDEX(Sheet2!$B$2:$B$4,SMALL(IF(ISNUMBER(SEARCH(SUBSTITUTE(Sheet2!$A$2:$A$4," ","")&",",SUBSTITUTE($A2," ","")&",")),ROW(Sheet2!$A$2:$B$4)-ROW(INDEX(Sheet2!$A$2:$B$4,1,1))+1),COLUMNS($B2:B2))),"")
 
Upvote 0
The standard-entry formula shown below should return multiple results in the corresponding order to the multiple items in column A of Sheet1 and it should not be upset by any blank rows in the table in Sheet2.


Book1
AB
1ISSNURL
20904-3535www.example.com
3
41433-7339www.example1.com
50941-4355www.example3.com
62076-0787www.example2.com
Sheet2



Formula in B2 is copied across and down.


Book1
ABCD
1ISSN
20904-3535www.example.com
30941-4355, 1433-7339www.example3.comwww.example1.com
42076-0787www.example2.com
Sheet1
Cell Formulas
RangeFormula
B2=IFERROR(VLOOKUP(TRIM(MID(SUBSTITUTE($A2,",",REPT(" ",100)),COLUMNS($B:B)*100-99,100)),Sheet2!$A$2:$B$10,2,0),"")
 
Upvote 0

Forum statistics

Threads
1,217,364
Messages
6,136,114
Members
449,993
Latest member
Sphere2215

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