A to Z of Excel Functions: The OR Function
19 June 2023
Welcome back to our regular A to Z of Excel Functions blog. Today we look at the OR function.
The OR function
The OR function is similar to AND, but only requires one condition to be TRUE. Similar to AND, the OR function may be used to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the OR function as the logical_test argument of the IF function, you can test many different conditions instead of just one.
For example, imagine you are in London on a Tuesday. Consider the expression
=OR(condition1, condition2, condition3)
- condition1 is the condition, “today is Tuesday”
- condition2 is the condition, “you are in London” and
- condition3 is the condition, “the Earth is flat”.
This would clearly be TRUE as you are definitely in London (that is, condition2 holds).
The syntax for OR is as follows:
OR(logical1, [logical2], …)
- logical1: the first condition that you want to test that can evaluate to either TRUE or FALSE
- logical2: additional conditions that you want to test that can evaluate to either TRUE or FALSE, up to a maximum of 255 conditions. logical2 is optional and is not needed in the syntax.
It should be noted that:
- The arguments must evaluate to logical values, such as TRUE or FALSE, or the arguments must be arrays or references that contain logical values
- If an array or reference argument contains text or empty cells, those values are ignored
- If the specified range contains no logical values, the OR function returns the #VALUE! error value.
In summary, OR works as follows:
We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every business day.
A full page of the function articles can be found here.