# search a string of numbers for a number

#### klatlap

##### Well-known Member
I have a string similar to this 1,9,7,11,8,10

I need a formula that would find 11 , the string can be different lengths so the number is not always in the same position.

### Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

So what do you want happened (result) once the formula finds it in the Text string, and what if it isn't there ?

But what do you want to result? a label that says "Yes it exists"

=IF(IFERROR(SEARCH("11",A1),0)=0,"Does not exist", "Yes it exists")

Last edited:
so the above formula can see the difference between 11 and 1?

Use B1 formula if you want the value to look for (i.e. 11) hard-coded in the formula.
Use C1 formula if you might want to look for different values using a cell reference.

Book1
ABCDEF
11,9,7,11,8,10YesYesFind What11
21,9,111,7,11,8,10YesYes
31,9,111,7,112,8,10NoNo
411,9,7,110,8,10YesYes
51,9,7,211,8,10,11YesYes
Sheet586
Cell Formulas
RangeFormula
B1=IF(ISNUMBER(FIND(",11,",","&A1&",")),"Yes","No")
C1=IF(ISNUMBER(FIND(","&F\$1&",",","&A1&",")),"Yes","No")

Formulas will Not error for 1, 111, 211, 112, etc., formula will Only result "Yes" if 11 exist within string.

Last edited:
cheers jtakw this worked well.

so the above formula can see the difference between 11 and 1?

Try this:

=IF(IFERROR(SEARCH(",11,",A1),0)=0,"No", "Yes")

@ DanteAmor, That won't work if the 11 is in the beginning or end of the string, you must Also include commas before and after the cell containing the string.

Last edited:
@ DanteAmor, That won't work if the 11 is in the beginning or end of the string, you must Also include commas before and after the cell containing the string.

@jtakw, You're right

Use this:

=SI(SI.ERROR(HALLAR(",11,", ","&A1&","),0)=0,"No", "Yes")

Replies
6
Views
171
Replies
4
Views
188
Replies
5
Views
143
Replies
1
Views
50
Replies
8
Views
132

1,214,523
Messages
6,120,033
Members
448,940
Latest member
mdusw

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