IF() with #VALUE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top