Logical
OR function in Excel:syntax and examples
OR checks several conditions and returns TRUE if at least one is met; it returns FALSE only if all of them fail. In Spanish Excel it is called O. Syntax: =OR(logical1, [logical2], ...). It is almost always used inside IF.
Syntax
=OR(logical1, [logical2], ...)In English Excel, arguments are separated with a comma (,). In Spain and much of Europe and Latin America, Excel uses a semicolon (;).
Arguments
| Argument | What it is |
|---|---|
logical1 | Required. The first condition. Example: B3>=50. |
logical2, ... | Optional. More conditions, up to 255. Example: C3="Yes". |
How do you use the OR function? A step-by-step example
OR checks whether at least one condition is met. In this example, a student is eligible for a retake if they scored 50 or more or submitted the project.
| A | B | C | |
|---|---|---|---|
| 1 | Student | Score | Submitted project |
| 2 | Lucy Grant | 75 | Yes |
| 3 | Mark Rivera | 48 | Yes |
| 4 | Valerie Cruz | 50 | No |
| 5 | Daniel Ford | 92 | Yes |
| 6 | Cameron Hayes | 31 | Yes |
=OR(B3>=50,C3="Yes") returns TRUE for Mark: he failed, but he submitted.
B3>=50is the first condition: not met (48).C3="Yes"is the second: met.- With one met, OR returns TRUE.
To write a result, put it inside IF: =IF(OR(B6>=50,C6="No"),"Retake","No retake") returns No retake for Cameron, because neither condition is met.
What does OR return in each case?
| Condition 1 | Condition 2 | OR |
|---|---|---|
| TRUE | TRUE | TRUE |
| TRUE | FALSE | TRUE |
| FALSE | FALSE | FALSE |
OR returns FALSE only when all of them fail.
To know whether a cell is one of several values, repeat the cell in every condition: =OR(A2="Lucy Grant",A2="Daniel Ford") returns TRUE and, with Mark in A3, FALSE.
As with AND, you will see sheets that add conditions: =(B3>=50)+(C3="Yes") returns 1 for Mark. Any result greater than 0 is the same as TRUE.
OR, AND or XOR?
| OR | AND | XOR | |
|---|---|---|---|
| TRUE if | At least one is met | All are met | An odd number are met (with two: only one) |
| Lucy (75 and submitted) | TRUE | TRUE | FALSE |
| Mark (48 and submitted) | TRUE | FALSE | TRUE |
| Versions | All | All | Excel 2013 and later |
All three can be combined. =OR(AND(B3>=45,C3="Yes"),B3>=50) passes anyone with a 50, or a 45 with the project submitted: for Mark it returns TRUE.
How does OR show up in an Excel test?
In a job interview the typical case is a priority: "Flag as urgent any ticket from a VIP customer or open for more than 3 days." They expect IF(OR(...),"Urgent",""). What they look for: each condition is complete.
In a skills test:
If A1 and B1 are FALSE, what does
=OR(A1,B1)return? a) TRUE · b) FALSE · c) 0 · d) #VALUE!
Answer: b. OR only returns FALSE when all the conditions are FALSE. For several results beyond yes or no, see IFS.
Practice the OR function
The English exercises are on the way. Until then, copy the scores table into a blank sheet, try each formula above, and then change Cameron's project to Yes to see the retake flip.
Available in: OR, in all versions of Excel. XOR, in Excel 2013 and later. Sources: Microsoft: OR function and XOR function. Results calculated with Formulo's engine.
Common mistakes
- You used OR where it had to be AND
- With OR, one condition is enough. For Valerie (a 50, no project), =OR(B4>=50,C4="Yes") returns TRUE. If the requirement is to meet both, it is AND.
- You wrote the values without repeating the cell
- Each condition has to be complete: =OR(A2="Lucy Grant",A2="Daniel Ford"). Writing only the second name does not compare A2 with it.
- A bare number counts as TRUE
- OR treats any number other than 0 as TRUE. =OR(B2) returns TRUE because B2 is 75. Write the whole comparison: B2>=50.
Frequently asked questions
What is OR called in Spanish?
O. In a Spanish Excel: =O(B3>=50;C3="Yes").
How do I make an IF that is met by one of two conditions?
With OR inside the IF: =IF(OR(B3>=50,C3="Yes"),"Eligible","Not eligible").
What is the difference between AND and OR?
AND needs all the conditions to be met. OR settles for one.
What is XOR?
The exclusive or (Excel 2013 and later): it returns TRUE if an odd number of conditions are met. With two, only if one is met and not the other. For Lucy, who meets both, =XOR(B2>=50,C2="Yes") returns FALSE.
How do I check whether a cell is one of several values?
Repeat the cell in every condition: =OR(A2="Lucy Grant",A2="Daniel Ford"). If the list is long, put it in a range and use COUNTIF(range,A2)>0.
Related functions
Practice in a real spreadsheet
Exercises with real data and instant checking. The first three are free.