View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
KarenF KarenF is offline
external usenet poster
 
Posts: 49
Default Wild Cards with IF stmt

ALL these solutions work beautifully! I never thought of using CountIF in a
a plain IF stmt (I'm not trying to count anything), but these are exactly
what I need. Thanks to all 3 of you ...

KarenF

"T. Valko" wrote:

If "Food" is *always* at the beginning of the string:

=IF(LEFT(X1,4)="Food","Yes,"No")

If "Food" might be anywhere within the string:

=IF(COUNTIF(X1,"*Food*"),"Yes","No")

--
Biff
Microsoft Excel MVP


"KarenF" wrote in message
...
I have a simple IF stmt that I can't get to recognize wild cards.

=IF(X1="Food*","yes","no")

I want it to return a yes for Food, Food Dept, Food Services - Intl, etc.
In short, anything that starts with food. Shouldn't it be easy?

I have a macro that imports from another spreadsheet. Once I get a
formula
to work, I record that step then paste it to my macro and adjust the code
so
it compiles, then add steps to copy the formula to the rest of the rows.

Which is why I can't simply filter on "contains food."

If I can get this simple function to work then I'm confident I can apply
it
to my complex formula. But, did I read somewhere that IF stmts don't
support
wild cards?

KarenF