Logical
When either test may pass
Definition
Showing 1 when either of two tests passes means wrapping OR inside IF.
Syntax
=IF(OR(logical1, logical2),1,0)
Arguments
| Argument | Meaning |
|---|---|
logical1 |
The first test, for example B2>50. |
logical2 |
The second test, for example C2="yes". |
Worked example
A desk flags a rush when quantity in B2 is over 50 or the vip cell in C2 is yes.
| A: Ticket | B: Quantity | C: Vip |
|---|---|---|
| T-14 | 12 | no |
| T-15 | 80 | no |
| T-16 | 9 | yes |
Formula: =IF(OR(B2>50,C2="yes"),1,0)
Result: 0. 12 is not over 50 and C2 is not yes, so neither test passes.
Practice
Cell C2 holds 20. Cell D2 holds 1. In E2, write a formula that shows 1 when C2 is greater than 10 or D2 is less than 5, and 0 otherwise.
- In E2, write an IF formula that uses OR and shows 1 when C2 is greater than 10 or D2 is less than 5, and 0 otherwise.
- E2 should show the result for 20 and 1.
Step 1 of 2
Enter =IF(OR(C2>10,D2<5),1,0) in E2.
C2 is 20, which is greater than 10, and D2 is 1, which is less than 5, so the result is 1.
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…
E2 uses OR.
E2 now shows 1.
The next lesson is Building a date from three numbers.
Related functions
OR is the function that lets either test pass.
Common mistake
Leaving out the vip test, as in =IF(OR(B2>50),1,0): T-16 would show 0 even though C2 is yes.