IF() with #VALUE

A

avgrin

IF(search(A1, B2)>0,A,B)
I'm searching for a string in A1 in the cell B2, if B2 contains A1, search()
returns starting position of A1, and operation A is performed. However, when
it is not there, #VALUE is returned. How do I get operation B?
Thank you
 
E

Elkar

Try this:

=IF(ISNUMBER(SEARCH(A1,B2),A,B)

This way, if SEARCH returns a number (starting position), A is performed.
Anything else (like #VALUE!), B is performed.

HTH,
Elkar
 
R

Ron Coderre

Perhaps something like this:
=IF(COUNTIF(B1,"*"&A1&"*"),expr_A,expr_B)

Is that something you can work with?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)
 
Top