Search for text within Cell with Comma Seperated values

Ronanm

Board Regular
Joined
Nov 13, 2010
Messages
107
Hi

I have searched and found solutions, but none worked with my problem.

I have a Column of values E.G. In Column "B" Cell B2 will have 32,57,39. Column A Cell A2 will have a single number E.G. 57. If this is the case, Column C2 should contain "True".

I have tried "(--ISNUMBER(SEARCH(", "&A2&",",B2)>0)" and ISNUMBER(SEARCH(",A2,",","&B2&",")) etc.. but to no avail...


Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Why do you need to search the commas? Isn't:


Excel 2010
ABC
132,57,395757
Sheet29
Cell Formulas
RangeFormula
C1=IF(ISNUMBER(SEARCH(B1,A1)),B1,"")


good enough? (maybe not...)
 
Last edited:
Upvote 0
=isnumber(search(b2&",",a2&","))

You may have problems searching for single digit numbers
Or even 3 or more digit numbers that contain smaller numbers.

ie

searching for 57 in a group that contains 113, 257, 341
doesn't contain 57 but will return TRUE due to 257.
 
Last edited:
Upvote 0
=isnumber(search(b2&",",a2&","))
You should put commas on each side so you don't match a larger number ending with the searched for number (plus you can use FIND instead of SEARCH as there is no upper/lower case text to worry about)...

=ISNUMBER(FIND(","&B2&",",","&A2&","))
 
Upvote 0
Hi and thanks all

Rick I used ISNUMBER(FIND(","&B2&",",","&A2&",")) but didn't work if any spaces within the comma separated values, but added Substitute ISNUMBER(FIND(","&B2&",",","&SUBSTITUTE(A2," ","")&","))

Cheers
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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