Unwanted #VALUE! when searching for text using either SEARCH or FIND

charlesstricklin

Board Regular
Joined
May 6, 2013
Messages
88
Office Version
  1. 2010
Platform
  1. Windows
Maybe it's just morning and my brain isn't working yet, but I'm struggling with the SEARCH function. I want to search a cell for a text snippet, and if it's found return "Yes"and if not, simply a null string/leave a blank. I.e.:

C2 being equal to "Foobar"

=IF(SEARCH("Foo",C2),"Yes",""))

However, when the text is not found, it returns #VALUE! instead.

I'm certain I'm not doing something extremely simple, but I can't seem to wrap my brain around it this morning. Please help?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
would this work for you?

=IFERROR(IF(SEARCH("foo",C2,0),"yes",""),"")

dave
 
Upvote 0
you can use iferror or iserror

=IF(iserror(SEARCH("Foo",C2)),"","Yes"))
 
Upvote 0
or try this

=IF(ISNUMBER(SEARCH("foo",C2)),"yes", "")

dave
 
Upvote 0
or try this

=IF(ISNUMBER(SEARCH("foo",C2)),"yes", "")

dave

This was the winning formula, thanks!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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