Logical
OR
Definition
OR returns TRUE when at least one of the tests you give it is true, and FALSE otherwise.
Syntax
=OR(logical1, [logical2], ...)
Arguments
| Argument | Meaning |
|---|---|
logical1 |
The first test, such as A2<0. |
logical2, ... |
Optional extra tests. Any one of them can be true for OR to return TRUE. |
Worked example
A ferry waits if the temperature is below 0 or the ice flag is 1. Temperature is in A2:A4 and the ice flag is in B2:B4.
| A: Temp | B: Ice |
|---|---|
| 18 | 0 |
| -2 | 0 |
| 4 | 1 |
Formula: =IF(OR(A2<0,B2=1),"Stop","Go")
Result: Go. 18 is not below 0 and the ice flag is 0, so OR is false and IF returns Go. Filled down, the formula gives Go, Stop, and Stop.
Practice
Cell A2 holds 2 and cell B2 holds 8. In C2, write a formula that returns 1 when A2 is greater than 10 or B2 is less than 5, and 0 otherwise.
- In C2, write an IF formula that uses OR and shows 1 when A2 is greater than 10 or B2 is less than 5, and 0 otherwise.
- C2 should show the result for 2 and 8.
Related functions
OR is often nested in IF. AND is the partner that requires every test to pass instead of any test.
Common mistake
Expecting OR to require both tests, the way AND does: with temperature 18 and ice 0, neither A2<0 nor B2=1 is true, so OR is false and IF returns Go.