Google Sheets function · Logical
OR in Google Sheets: syntax and examples
OR takes any number of tests and returns TRUE if at least one is TRUE, FALSE only when all are FALSE. It is usually placed inside IF, FILTER or conditional formatting rules.
Syntax
OR(logical_expression1, [logical_expression2, ...])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
logical_expression1 | boolean | yes | A test or value that is TRUE or FALSE. Numbers also work: 0 is FALSE, any other number is TRUE. |
logical_expression2, ... | boolean | no | More tests. OR is TRUE as soon as one of them is TRUE. |
Examples
The examples use this table, starting in A1:
| Region | Product | Units | Price |
| North | Pen | 10 | 2.5 |
| South | Pen | 4 | 2.5 |
| North | Book | 3 | 12 |
| East | Book | 8 | 12 |
| South | Lamp | 5 | 30 |
=OR(C2>5, C3>5)Result: TRUE
Is either of the first two rows above 5 units? C2 is 10, so the answer is TRUE.
Run in a Google Sheet (English US locale) on .
=OR(A2="East", A3="East")Result: FALSE
Neither cell says East, so every test is FALSE and OR returns FALSE.
Run in a Google Sheet (English US locale) on .
=IF(OR(A4="North", A4="East"), "ship", "hold")Result: ship
OR inside IF: the row is North, so the first branch runs.
Run in a Google Sheet (English US locale) on .
=AND(OR(A2="North", A2="East"), C2>5)Result: TRUE
OR as one half of AND: the region is North or East, and units are above 5.
Run in a Google Sheet (English US locale) on .
=OR(ARRAYFORMULA(C2:C6>9))Result: TRUE
A test over a whole column, wrapped in ARRAYFORMULA: is any row above 9? The 10 says yes.
Run in a Google Sheet (English US locale) on .
Common errors
- Text other than TRUE or FALSE makes OR return #VALUE!. =OR("yes", TRUE) fails.
- At least one argument is required: =OR() returns #N/A.
- A comparison on a whole range, such as OR(C2:C6>9), returns #VALUE!. Wrap it in ARRAYFORMULA, as in OR(ARRAYFORMULA(C2:C6>9)), so every row is tested.
Compared with Excel
Same syntax in Excel. In Excel 365 an array test inside OR works without a wrapper.