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

#### yield777

##### New Member
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 Name House Districts District 140 Appling 156, 178 0 0 Atkinson 176 0 0 Bacon 169 0 0 Baker 154 0 0 Baldwin 145 0 0 Banks 28 0 0 Barrow 114, 116, 117 0 0 Bartow 14, 15, 16 0 0 Ben Hill 155 0 0 Berrien 170 0 0 Bibb 140, 141, 142, Bibb 0

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

### Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Search woth leading comma as well:
=IF(ISNUMBER(SEARCH(", " & \$O\$2&",", ", "&D13&",")),A13,0)
note the change from "," to ", " (ending space)

Thanks alot, what does the ", " (with the space) actually tell the formula,a s compared to "',"?

Replies
0
Views
1K
Replies
5
Views
463
Replies
1
Views
610
Replies
3
Views
637
Replies
4
Views
9K

1,219,978
Messages
6,151,246
Members
451,019
Latest member
cichli_04

### 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.

### Which adblocker are you using?

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

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