Paula
Paula

Reputation: 229

Multiple Criteria

Is it possible to use an IF statement for multiple criteria? or what would I be best using... I have tried to amend the question with what I'm looking to do the code isnt correct in this but it may highlight more what Im looking to achieve.

If(A3="Dog","Dog Green","Dog Blue"),Matches,doesn’t match)

For some reason it wont let me upload a picture....

Any help/advice would be greatly appreciated

Upvotes: 0

Views: 81

Answers (3)

theAccountant.py
theAccountant.py

Reputation: 141

This will definitely work:

=IF(OR(A3="Dog",A3="Dog Green",A3="Dog Blue"),"Matches","doesn’t match")

just ad OR statement inside IF Statement Don't forget to use Quotation marks also

Upvotes: 2

Grade 'Eh' Bacon
Grade 'Eh' Bacon

Reputation: 3843

There are many ways to test for multiple criteria in Excel. Probably the easiest would be either to:

Use the AND / OR BOOLEAN operaters. AND(test1,test2...) checks to see whether each of test1 & test2 are TRUE (can hold as many arguments as you need). ie:

=if(And(A1="dog",B1="cat"),"there is a cat and a dog", "there is not both a cat and a dog")

OR(test1,test2) checks to see whether either test1 is TRUE, or test2 is TRUE, or if both are true. ie:

=if(Or(A1="dog",B1="cat"),"There is either a cat, or there is a dog, or both","there is neither a cat nor a dog")

Another broad option is to 'nest' one IF statement inside of another. ie:

=if(A1="dog","There is a dog. Have not checked for cats",if(B1="cat","A1 is not a dog, and also B1 is a cat","There is neither a cat nor a dog"))

If you have more specific questions you should update your question with all possible details you have.

Upvotes: 1

David G
David G

Reputation: 2355

It's a simple formula you could have found on google:

=ISNUMBER(FIND("dog",A1))

Will return True if dog is in A1 and false if it is not.

For further reading (well explained) https://exceljet.net/formula/cell-contains-specific-text

Also, it seems to me like this is a single-criteria. What do you mean by multiple criteria?

Upvotes: 1

Related Questions