Excel Logical Functions
Excel Logical Functions
1) IF (Already done)
2) IFS
3) AND
4) OR
5) NOT
6) XOR
2) IFS
The Excel IFS function can run multiple tests and return a value corresponding to the first
TRUE result. Use the IFS function to evaluate multiple conditions without multiple nested
IF statements. IFS allows shorter, easier to read formulas.
The AND and OR Logical Functions
The AND and OR functions are used when you want to perform more than one
comparison in your formula. The IF function alone can only handle one condition, or
comparison.
The AND function returns TRUE only if every condition is met, and otherwise returns
FALSE.
The OR function returns TRUE if one or all of the conditions are met, and returns FALSE
only if no conditions are met.
These functions can test up to 255 conditions, so are certainly not limited to just two
conditions like is demonstrated here.
Below is the structure of the AND and OR functions. They are written the same. Just
substitute the name AND for OR. It is just their logic which is different.
You can see that it returns FALSE for Matt and Terry because although they both meet
one of the criteria, they need to meet both with the AND function.
OR Function Example
The OR function is used below to test if the customer spends at least £3,000 or has
been a customer for at least three years.
Using AND and OR with the IF Function
Because the AND and OR functions return the value of TRUE or FALSE when used
alone, it’s rare to use them by themselves.
Instead, you’ll typically use them with the IF function, or within an Excel feature such
as Conditional Formatting or Data Validation to perform some retrospective action if
the formula evaluates to TRUE.
In the formula below, the AND function is nested inside the IF function’s logical test. If the
AND function returns TRUE then 10% is discounted from the amount in column B; otherwise,
no discount is given and the value in column B is repeated in column D.
This function can take some effort to understand, so a practical example is shown.
This differs from the OR function because that would return TRUE if both conditions
were TRUE.
Let’s look at a simple example of the XOR function.
In this example, sales are split over two halves of the year. If a salesperson sells
£3,000 or more in both halves, then they are assigned Gold standard. This is achieved
with an AND function with IF like earlier in the article.
But if they sell £3,000 or more in either half then we want to assign them Silver status.
If they don’t sell £3,000 or more in both then nothing.
The XOR function is perfect for this logic. The formula below is entered into column E
and shows the XOR function with IF to display “Yes” or “No” only if either condition is
met.
=NOT(logical)
Example:
In this example, imagine we have a head office in London and then many other regional sites.
We want to display the word “Yes” if the site is anything except London, and “No” if it is
London.