Excel OR Function
The OR function is a logical function to test multiple conditions at the same time. OR returns either TRUE or FALSE. For example, to test A1 for either "x" or "y", use =OR(A1="x",A1="y"). The OR function can be used as the logical test inside the IF function to avoid extra nested IFs, and can be combined with the AND function.
- logical1 - The first condition or logical value to evaluate.
- logical2 - [optional] The second condition or logical value to evaluate.
Use the OR function to test multiple conditions at the same time, up to 255 conditions total. Each logical condition (logical1, logical2, etc.) must return TRUE or FALSE, or be arrays or references that contain logical values.
The OR function will evaluate all values supplied and return TRUE if any value evaluates to TRUE. If all logicals evaluate to FALSE, the OR function will return FALSE.
Both the AND function and the OR function will aggregate results to a single value. This means they can't be used in array operations that need to deliver an array of results. For more context, see: Array formulas with AND and OR logic.
For example, to test if the value in A1 OR the value in B1 is greater than 75, use the following formula:
OR can be used to extend the functionality of functions like the IF function. Using the above example, you can supply OR as the logical_test for an IF function like so:
This formula will return "Pass" if the value in A1 is greater than 75 OR the value in B1 is greater than 75.
If you enter OR as an array formula, you can test all values in a range against a condition. For example, this array formula will return TRUE if any cell in A1:A100 is greater than 15:
- Each logical condition must evaluate to TRUE or FALSE, or be arrays or references that contain logical values.
- Text values or empty cells supplied as arguments are ignored.
- The OR function will return #VALUE if no logical values are found