* in IF statement

H

Harley

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA
 
R

Ron Coderre

Try one of these:

=IF(ISNUMBER(SEARCH("abc",A1)),"in there","not there")
or
=IF(COUNTIF(A1,"*abc*"),"in there","not there")

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro
 
D

Dave Peterson

=if(isnumber(search("abc",a1)),"yep","nope")

=search() is case sensitive.
=find() is not.

alternatively:

=if(countif(a1,"*abc*")>0, "yep", "nope")

(not case sensitive)
 
D

Dave Peterson

=find() IS case sensitive
=search() IS NOT.

(and =countif() is not case sensitive)

Dohhh.
 
Top