SEARCH function returning #VALUE! error

J

jhchan

I'm trying to use an IF statement with my SEARCH function so that if a "-" is
found I will do one thing but if it is not found it will do something else.

However, the statement bombs when there is no "-" found. It returns the
#VALUE! and it no longer evaluates my IF expression. It just stops and
returns the error value instead of giving it the value I put in the IF
statement for false.

Anyone know how to get around that?
my test statement looks like this:
=IF(SEARCH("-",B178) > 0, "True", "FALSE")
 
D

David Biddulph

=IF(ISNUMBER(SEARCH("-",B178)), "True", "FALSE")
or if you want a logical rather than text
=ISNUMBER(SEARCH("-",B178))
 
Top