This tutorial shows how to calculate If cell is x or y and z in Excel using the example below;
You can combine logical statements with the OR and AND functions inside the IF function.
If color is red or green and quantity is greater than 10
In the example shown, we simply want to “mark” or “flag” records where the color is either red OR green AND the quantity is greater than 10.
In D5, the formula were using is this:
How this formula works
In this formula, the logical test is this bit:
Note that the “parent” function is AND The OR function is logical1 inside the AND function while C5>10 is logical2.
This snippet will return TRUE only when the color in B5 is either “red” OR “green” AND the quantity in C5 is greater than 10.
The IF function then simply catches the result of the above snippet and returns “x” when the result is TRUE and “” (nothing) when the result is false.
Note: if we didn’t add the empty string when FALSE, the formula would actually display FALSE whenever the color is not red.