Logic and errors function
OR function in Google Sheets and Excel
In Google Sheets and Excel, the OR function checks several conditions and returns TRUE when at least one of them is TRUE.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
OR(logical1, [logical2], ...)Arguments in [brackets] are optional. Google Sheets writes it OR(logical_expression1, [logical_expression2, ...]).
Example
=OR(H2="Pending",H2="Returned") reads: Is H2 (the order's status) "Pending", or is it "Returned"? TRUE if either one is.
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Order | Date | Customer | Product | Category | Qty | Price | Status | Needs attention? |
| 2 | 1001 | 2 Mar 2026 | Mara Okafor | Monstera | Plants | 1 | $34.00 | Shipped | FALSE |
| 3 | 1002 | 2 Mar 2026 | Jonas Lind | Terracotta pot | Pots | 3 | $12.50 | Shipped | FALSE |
| 4 | 1003 | 3 Mar 2026 | Priya Raman | Snake plant | Plants | 2 | $22.00 | Shipped | FALSE |
| 5 | 1004 | 4 Mar 2026 | Tomás Ruiz | Watering can | Tools | 1 | $18.00 | Pending | TRUE |
| 6 | 1005 | 5 Mar 2026 | Elif Demir | Fern | Plants | 4 | $9.50 | Shipped | FALSE |
| 7 | 1006 | 5 Mar 2026 | Mara Okafor | Potting mix | Soil | 2 | $7.25 | Returned | TRUE |
| 8 | 1007 | 6 Mar 2026 | Kenji Mori | Pruning shears | Tools | 1 | $24.00 | Shipped | FALSE |
| 9 | 1008 | 7 Mar 2026 | Ines Varga | Ceramic pot | Pots | 2 | $19.00 | Pending | TRUE |
| 10 | 1009 | 8 Mar 2026 | Jonas Lind | Monstera | Plants | 1 | $34.00 | Shipped | FALSE |
| 11 | 1010 | 9 Mar 2026 | Sofia Rossi | Fern | Plants | 6 | $9.50 | Shipped | FALSE |
| 12 | 1011 | 10 Mar 2026 | Priya Raman | Potting mix | Soil | 5 | $7.25 | Shipped | FALSE |
| 13 | 1012 | 11 Mar 2026 | Leo Brandt | Snake plant | Plants | 1 | $22.00 | Pending | TRUE |
I5 shows TRUE: order 1004 is Pending. I2 and the other shipped orders show FALSE.
How the spreadsheet calculates it
Is TRUE when at least one of these is true: H2 is equal to "Pending"; H2 is equal to "Returned".
- 1. OR: Is TRUE when at least one of these is true:
H2is equal to"Pending";H2is equal to"Returned".condition1=`H2="Pending"`: the first comparisoncondition2=`H2="Returned"`: the next one; OR is TRUE if any is TRUE
More OR examples
=IF(OR(H2="Pending",H2="Returned"),"Follow up","")Flags orders that aren't simply shipped.=OR(C2>15000,D2>15000,E2>15000)TRUE if any month of the quarter passed 15,000.=OR(F2>=5,G2>=30)A large order: five or more items, or a price of 30 or more.=NOT(OR(H2="Pending",H2="Returned"))TRUE when the status is neither Pending nor Returned.
Paste any of these into the formula explainer to see it step by step.
Tips
- Repeat the cell in every comparison:
H2="Pending",H2="Returned". - When the list of values grows, move it into cells and use COUNTIF instead of a long OR.
- Wrap OR in NOT for "none of these":
NOT(OR(…)).
What OR is used for
Flagging rows that need attention (pending or returned orders, overdue or missing values), accepting several valid answers, and conditional formatting or filter rules where any one condition is enough.
Arguments
| Argument | Required | What it is |
|---|---|---|
| logical1 | Yes | The first condition, such as H2="Pending". |
| logical2, ... | No | Up to 255 conditions in all. OR is FALSE only when every one is FALSE. |
Common mistakes
Writing
H2="Pending" OR "Returned": each comparison needs its ownH2=.Using OR with not-equal tests:
OR(H2<>"Pending",H2<>"Returned")is always TRUE, because every status differs from at least one of them. For "neither", use AND (or NOT around OR).Expecting OR to say which condition matched: it only returns TRUE or FALSE. Use IFS or nested IFs to return a different result per condition.
In Google Sheets
Google Sheets' OR works the same way; Google calls the arguments logical_expression1, logical_expression2…
Errors you may see with OR
Questions
How do I check if a cell is one of many values?
For two or three values, list each comparison inside OR. For a longer list, keep the values in a range and count matches: COUNTIF($K$2:$K$6,H2)>0 is TRUE when H2 is anywhere in K2:K6.
How do I use OR inside IF?
Make OR the condition: =IF(OR(H2="Pending",H2="Returned"),"Follow up","") flags the orders that need attention. See IF with AND and OR.
How do I combine AND and OR?
Nest them: =AND(B2="East",OR(C2>12000,D2>12000)) is TRUE for East reps who passed 12,000 in July or in August.
What's the difference between OR and XOR?
OR is TRUE when one or more conditions are TRUE. XOR with two conditions is TRUE only when exactly one of them is.
Sources
Official documentation the facts on this page were checked against.