If a cell contains "preferred" then do this

S

SteveC

here is what I got =if(a1="*preferred*","B","A")

what do I do to make it work?

thanks... Steve

trying to match partial text in a cell

a1 might have "preferred chimichangas" or "preferred nonsense" for example...
 
D

Dave Peterson

One way:

=if(countif(a1,"*preferred*")>0,"B","A")

another:
=if(isnumber(search("preferred",a1)),"B","A")

if you want to make it case sensitive, replace "search" with "find".

(=Countif() is not case sensitive)
 
T

Tracey

Thank you Dave,

You saved me hours of work!!!!!
I needed the same formula as well!!!
 
Top