Formula Help If number ="x" in string of numbers containing commas return "x"

yield777

New Member
Joined
Sep 16, 2014
Messages
2
Wanting to search the house district column for a specific district number and return the county name. The formula below works, but returns the county name (Bibb) for 140 and/or 40 instead of for just the district 140 that is being searched for. How can I get it to just pull it for 140 and not 40 or 0, etc? Thank you.

=IF(ISNUMBER(SEARCH($O$2&",",","&D13&",")),A13,0)

County NameHouse DistrictsDistrict140
Appling156, 17800
Atkinson17600
Bacon16900
Baker15400
Baldwin14500
Banks2800
Barrow114, 116, 11700
Bartow14, 15, 1600
Ben Hill15500
Berrien17000
Bibb140, 141, 142,Bibb0

<tbody>
</tbody><colgroup><col><col span="3"><col><col span="4"></colgroup>
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Search woth leading comma as well:
=IF(ISNUMBER(SEARCH(", " & $O$2&",", ", "&D13&",")),A13,0)
note the change from "," to ", " (ending space)
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,755
Members
449,049
Latest member
excelknuckles

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