AND/OR Function
AND/OR functions allow the user to check if multiple criteria are met. They are extremely useful when combined with the IF function.
The AND function is used for checking if all criteria are met
The OR function is used for checking if at least one criterion is met.
We can check dozens of criteria in each of these functions!
Syntax
AND function:
=AND(logical1, [logical2], …)
OR function:
=OR(logical1, [logical2], …)
logical1 – First condition
logical2 – Second condition
logical3 – Third condition
and so on…
As noted previously, these functions are extremely useful when combined with an IF function, so let’s see how it’s combined together:
AND combined with IF function:
=IF(AND(logical1, logical2),value if true, value if false)
In this example, if logical1 and logical2 criteria are met, the IF function will return value if true. If any of these criteria are not met, the IF function will return value if false.
OR combined with IF function:
=IF(OR(logical1, logical2),value if true, value if false)
In this example, if at least one of the following criteria is met – either logical1 or logical2 – the IF function will return value if true. If all of these criteria are not met, the IF function will return value if false.
Example
For our example, let’s assume that you have an insurance company that provides an insurance discount to drivers over the age of 50 or those who lead a healthy lifestyle.
A healthy customer is a customer who doesn’t smoke, doesn’t drink and isn’t overweight.
Let’s see which customers will be entitled to an insurance discount!
0 Comments