Search results in #VALUE! error

Mike Welch

Board Regular
Joined
May 26, 2010
Messages
64
Platform
  1. Windows
  2. MacOS
I'm looking for the word "and" in a text string, A1, and want to know where it occurs. I'm using

=SEARCH("and",A1)

If it's there I get a number indicating where it's located, e.g.: 55 If it's not there I get #VALUE! - I'd rather have nothing at all. Any ideas?

Also, what if I just wanted a Yes/No response to finding the word "and"? I tried =IF(SEARCH("and",A1),"yes", "no") but that failed.

Mike Win XP Pro SP3 / Excel 2003 SP3
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I'm looking for the word "and" in a text string, A1, and want to know where it occurs. I'm using

=SEARCH("and",A1)

If it's there I get a number indicating where it's located, e.g.: 55 If it's not there I get #VALUE! - I'd rather have nothing at all. Any ideas?

Also, what if I just wanted a Yes/No response to finding the word "and"? I tried =IF(SEARCH("and",A1),"yes", "no") but that failed.

Mike Win XP Pro SP3 / Excel 2003 SP3
Try one of these...

=IF(COUNT(SEARCH("and",A1)),SEARCH("and",A1),"Not Found")

=IF(COUNT(SEARCH("and",A1)),"Yes","No")
 
Last edited:
Upvote 0
If you wanted to return 0 if you didn't find it, perhaps:

=LOOKUP(32768,CHOOSE({1,2},0,SEARCH("and",A1)))
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,777
Members
452,942
Latest member
VijayNewtoExcel

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