If Statement with Like?

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hello,

Wondering if you can use an if statement with "LIKE"
For example, I have an if statment:
=IF(W2="San Antonio Trade Group",0,AH2*0.85*0.005)

but if someone types in only San Antonio then I will have
a problem. Is there an If then statement with a "LIKE"?
I know access has the like feature.

Thank you
 
Hello,

Wondering if you can use an if statement with "LIKE"
For example, I have an if statment:
=IF(W2="San Antonio Trade Group",0,AH2*0.85*0.005)

but if someone types in only San Antonio then I will have
a problem. Is there an If then statement with a "LIKE"?
I know access has the like feature.

Thank you

You could use a slightly different construct, plus wildcard characters.

For example:

=IF(COUNTIF(W2,"San Antonio*"),0,AH2*0.85*0.005) will branch to value_if_true
if W2 starts with San Antonio.


--ron
 
Frank,

Thanks a lot. It worked!
Tony
-----Original Message-----
Hi
you could try
=IF(COUNTIF(W2,"*San Antonio*")=0,0,AH2*0.85*0.005)


--
Regards
Frank Kabel
Frankfurt, Germany


.
 
Back
Top