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

charlesstricklin

Board Regular
Joined
May 6, 2013
Messages
67
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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,090
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
would this work for you?

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

dave
 
Upvote 0

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
7,006
Office Version
  1. 365
Platform
  1. MacOS
you can use iferror or iserror

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

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,090
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
or try this

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

dave
 
Upvote 0

nithin shettigar

New Member
Joined
Mar 16, 2014
Messages
44
BC
2FoobarYES

<tbody>
</tbody>


=IFERROR(IF(SEARCH("FOO"&"*",B2),"YES",""),"")

This may help you :):)
 
Last edited:
Upvote 0

charlesstricklin

Board Regular
Joined
May 6, 2013
Messages
67
Office Version
  1. 2010
Platform
  1. Windows
or try this

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

dave

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

Forum statistics

Threads
1,191,171
Messages
5,985,067
Members
439,938
Latest member
MAlhash

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
Top