Have you ever had a situation where you wanted to have an if statement test more than one condition in order have a true? I have seen people do this several ways, but there is an easy way. Nesting functions.
You can use either the AND or the OR function where the logical test would be. How would this look?
= IF ( AND ( test1 , test2 …) , true , false )
Say you wanted the word Bonus to appear if G5 was greater than B5 and they have to have a B in cell C5. The if statement would look like this:
= IF ( AND ( G5 > B5 , C5 = “B” ) , “Bonus” , “”)
In the example above nothing would appear in the cell if the 2 logical tests were not met.
The OR function can be used when in an either or position, such as cell G5 has to be greater than B5 or there is a B in cell C5 then the word Bonus is to appear in the cell. Any of the conditions have to be true for the IF statement to return the true statement. It would look like this:
= IF ( OR (G5 > B5 , C5 = “B”) , “Bonus” , “”)
If you are not sure which to use, try one then see what is returned, I find that sometimes I know where I went wrong just by looking at what rows Excel has decided to return the true statement.
For each of the AND and OR functions you can have more than 2 items, in older version of Excel you were limited to 30 but in more recent versions you can have a lot more.
Try it out.