How do I use a wildcard in an if statement?

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

Guest

I want to use a conditional statement to see if a particular cell has a
specific text within a cell. For example:
I want to know if cell A1 contains the text "bag" even though it actually
contains "Large BAG 3".

I want this to work but it does not:
if(A1="*bag*","yes","no")
It should return "yes" since bag is within the cell.
Please help.
 
You could use:
=IF(ISERROR((FIND("Bag",A1,1))),"no","yes")
But keep in mind that FIND is case sensitive.

You could also use:
=IF(ISERROR((SEARCH("*Bag*",A1,1))),"no","yes")
This would avoid case sensitivity.

tj
 
I put unnecessary parentheses in those formulas. They work just fine like this:

=IF(ISERROR(FIND("Bag",A1,1)),"no","yes")
=IF(ISERROR(SEARCH("*Bag*",A1,1)),"no","yes")

tj
 

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