What is the Excel OR Function?
Excel OR function used to determine a condition. If met ANY of the conditions returns TRUE. If not met ALL conditions return FALSE.
OR Syntax
OR(logical1, [logical2], ...)
logical1, required, evaluate the first condition
logical2, optional, up to a maximum of 255 conditions
Excel ignore any argument contains text or empty cells. OR function returns the #VALUE! Error if any argument contains no logical values.
How to Use OR Function in Excel
OR function with two conditions
The following is an example of using an OR function with two conditions to be evaluated.
The result is as shown below
The OR function returns TRUE if there is a TRUE condition, either one or all.
OR function with three conditions
The following is an example of using an OR function with three conditions to be evaluated.
The result is as shown below
From the picture above, OR function returns TRUE if there is only 1 logical value TRUE. Returns FALSE if all conditions are FALSE.
OR Example, Have You No Ideal Weight?
For example, there are data such as the image below
Which of the twelve names above have no ideal weight? The BMI value (body mass index) determine the criteria. You can calculate The BMI value by dividing the weight (in KG) by the height (in Meter2).
According to BMI, the ideal weight criteria is greater than or equal to 18.5 and smaller or equal to 24.9. The BMI value for not perfect weight is the opposite, i.e., less than 18.5 OR more than 24.9.
There are two conditions to be evaluated. Condition #1 BMI<18.5 and condition #2 BMI>24.9. If met ANY of the conditions then returns TRUE (Not ideal weight). So, use OR function to evaluate the conditions.
Here are the steps on how to use OR function.
- Place the cursor in cell E2
- Type the OR formula
- Fill the first argument logical1 with condition #1, D2<18.5
- Fill the second argument logical2 with condition #2, D2>24.9
- Press the ENTER key
If completely typed, the formula will look like below.
=OR(D2<18.5,D2>24.9)
Do a copy in cell E2 then paste in range E3:E13. The result is as shown below.
There are ten names have no ideal weight (under or over). All of them met one of two conditions.
The result of OR function is not informative, because it only displays TRUE/FALSE value. Want more informative result? Use Excel IF Statement.
Another OR Function Alternative
Due to the unique characteristic of TRUE/FALSE logical value, you can use simple addition formula as OR function replacement. TRUE converted to number 1 and FALSE to number 0 if involved in mathematical operations.
The logical OR function will be TRUE if at least one condition is TRUE. The total value of addition formula at least 1, indicating there is a TRUE value.
Addition formula as OR function replacement with two conditions
Suppose there is data like the image below. Can you use the addition formula as OR function replacement?
The result is as shown below
The OR function and the addition formula have the same results.
Addition formula as OR function replacement with three conditions
If there are three conditions, can you use the addition formula instead of the OR function?
The result is as shown below
The addition formula and OR function results still the same.
An Example for OR Function Replacement, Have You No Ideal Weight?
Suppose there is data such as the picture below, the same study case with the previous. Can you use the addition formula instead of the OR function to find anyone who had not ideal weight?
According to BMI, not ideal weight is less than 18.5 OR more than 24.9.
There are two conditions; both do not have to be TRUE. The addition formula is used to add the condition #1 (checks whether BMI is less than 18.5) and condition #2 (checks whether BMI is more than 24.9).
Here are the steps to use the addition formula as OR function replacement.
- Place the cursor in cell F2
- Type an equal sign “=”
- Condition #1 is to check whether cell D2<18.5
- Type + (plus) sign for the addition formula
- Condition #2 is to check whether cell D2> 24.9
- Check whether the total of condition #1 and condition #2 is greater than or equal to 1
- Press the ENTER key
If completely typed, the formula will look like below.
=(D2<18.5)+(D2>24.9)>=1
Do a copy in cell F2 then do a paste in range F3:F13. The result is as shown below.
The results are same as OR functions.