Formula to use cell with comma separated values as Lookup value

Cwillson

New Member
Joined
Oct 1, 2015
Messages
36
Office Version
  1. 2019
Platform
  1. Windows
Hey peeps,

I have a spreadsheet with a range in column (A) containing comma separated values in each cell.

I also have another range in column (B), consisting of cells with just a single value in each.

I'm looking for a formula which will confirm which of the comma separated values in column A can be found in column B. There may of course be more than one, so ideally I'd like a comma separated cell with the matching values.

If this last bit is super complex using formula (I can't run VB on work laptop - sigh) then it would be fine to simply return a "Y" if any of the comma separated values in column A can be found in column B!

Many thanks in advance!

C
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Can you post some sample data, so that we can see what your data looks like.
 
Upvote 0
ABC (Result)
11,5,7,1011,5
27,2,3,933
31,5,6,951,5,9
49

Hi Fluff,

It's something like this. If comma separated values in A1 are found in B:B the ideally populate C1 with comma separated matches. :)
 
Upvote 0
Shouldn't the result in Row 2 be "3,9"? Assuming that a typo, please see below.

Test.xlsx
ABCD
1ABC (Result)
21,5,7,1011,51,5
37,2,3,9333,9
41,5,6,951,5,91,5,9
59 
Sheet1
Cell Formulas
RangeFormula
D2:D5D2=TEXTJOIN(",",1,IFERROR($B$2:$B$5/ISNUMBER(SEARCH($B$2:$B$5,A2)),""))
 
Upvote 0
@Cwillson
As mentioned by Habtest, hopefully the result you show for 7,2,3,9 was a mistake since both 3 and 9 appear in column B?


@Habtest
That could return some incorrect results. For example, try changing cell A2 in your sample to 2,5,7,10

The following amendment should avoid that problem.

Cwillson.xlsm
ABC
1ABC (Result)
21,5,7,1011,5
37,2,3,933,9
41,5,6,951,5,9
59
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=TEXTJOIN(",",1,IF(ISNUMBER(FIND(","&B$2:B$5&",",","&A2&",")),B$2:B$5,""))
 
Upvote 0
@Habtest
That could return some incorrect results. For example, try changing cell A2 in your sample to 2,5,7,10

The following amendment should avoid that problem.

Cwillson.xlsm
ABC
1ABC (Result)
21,5,7,1011,5
37,2,3,933,9
41,5,6,951,5,9
59
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=TEXTJOIN(",",1,IF(ISNUMBER(FIND(","&B$2:B$5&",",","&A2&",")),B$2:B$5,""))
You are right Peter, I totally missed that :oops:
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,577
Members
449,039
Latest member
Arbind kumar

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