Just like the AND function, the OR is a logical function in Excel. The OR function returns True if any of the given condition(s) is True. It only returns False if all the given conditions evaluate as False.
The syntax for using the OR function
The syntax for using the OR function is:
=OR (condition1, [condition2], …)
- You may separate multiple conditions by a comma.
- Up to 255 conditions can be used in a single OR formula.
=OR(A2<=5, B2>=100, C2=20)
See the examples below for learning how we can use the OR function. The example also includes using the OR with the IF function (which is also a logical function).
The example of OR with a single condition
In the first example, I am using a single condition only in the OR function. For that, we have a value in the A2 cell that is used in the OR function. The B2 cell shows the returned value by OR.
Similarly, other A column cells are used for different result; all with single condition:
The formulas for different B cells are:
You can see the output in the above examples. Also, notice the usage of text in the OR function and the returned result.
Using multiple conditions example
For this example, I used two or more conditions in the OR function. To make it understand how it works, various combinations of True/False returned results are used as follows:
The formulas for C column (C2 to C4):
C2: =OR(A2>5, B2<15)
You can see, the returned result is False for only that formula for which all conditions are False. That is the C2 cell’s formula. In that case, neither A2 is greater than 5 nor B2 is less than 15.
In other cases, even one condition is True, the OR function returned the True.
An example of using the OR with IF function
Just like AND function, we may use the OR in conjunction with the IF function. In that case, the OR acts as the logical test in the IF function.
An example below shows the usage of OR function with IF. For that, we have an Excel sheet that contains the records of “Number of Sales” and “Sale amount” by the Sales Persons.
A salesperson is eligible for the bonus only if the number of sales is greater than or equal to 50. Similarly, if the sales amount is greater than $10,000, he/she is eligible for the bonus even if the number of sales is less than 50.
See how IF/OR functions are used to get the results:
The formula used in the D2 cell to get the result for sales person 1:
To get the result for other salespersons, just replace the B2 and C2 cells by their respective cells.
How to use ribbon for creating OR formula?
Rather than writing the formula in the formula bar yourself, you may also provide OR function arguments by accessing the menu in the ribbon.
To access the OR function:
Select a cell where you want to apply the formula and
Go to the “Formulas” in the ribbon
Locate the “Logical” group and click on the “OR” as shown below:
The “Function Arguments” popup comes up where you may enter up to 255 conditions that you want to test.
Enter the condition(s) as shown below:
You can see the result as you are entering the conditions.