OR function is useful when you want to evaluate a set of conditions.

It will return TRUE when any of the conditions being checked are met, else it returns FALSE.

This Tutorial Covers

OR(logical_expression1, [logical_expression2, …])

- logical_expression1 – The first condition that you want to check. This could be a cell reference that has the TRUE/FALSE value or an expression that returns logical values.
- [logical_expression2].. – Additional conditions that you want to check.

**Additional Notes:**

- OR function can be used with other formulas to be more efficient. For example, if you’re testing two conditions and your final result is ‘Pass’ if any of the two conditions is met. You can use a formula such as =IF(OR(A1=”Pass”,A2=”Pass”),”Pass”,”Fail”).
- The arguments must either evaluate to logical values (TRUE/FALSE), or the arguments must be arrays/references of logical values.
- Text and empty cells are ignored.
- If the specified range contains no logical values, the OR function returns #VALUE! error.

Now let’s look at some examples where you can use the OR function in Google Sheets.

Suppose you have a dataset as shown below and you want to find it any of the tests passed. If any of the tests pass, the formula should return PASS, else it should return FAIL.

The below formula can do this:

=ArrayFormula(IF(OR(B2:B4="Pass"),"Pass","Fail"))

Note that this is an array formula as we are testing multiple cells at one go. You don’t need to write this formula this way. You can simply write the formula =OR(B2:B4=“Pass”) and then use Control + Shift + Enter instead of just using Enter.

In the above formula, OR function evaluates the cells and returns TRUE if any of the tests is a ‘pass’, else it returns a false. If function then uses this result to return “Pass” or “Fail”.

Suppose you have a dataset as shown below:

You can use the OR function along with the WEEKDAY function to check if the day is a weekend or not.

Below formula would return TRUE if it’s a weekend day, else it will return FALSE.

=OR(WEEKDAY(A2,2)=6,WEEKDAY(A2,2)=7)

In this formula, the weekday function returns 6 for a ‘Saturday’ and 7 for a ‘Sunday’. OR function then returns TRUE when the result of WEEKDAY function is 6 or 7.

Suppose you have a dataset as shown below:

In the above case, access is granted only if you are from either Marketing or Sales department or you have the A grade classification.

The below formula will give TRUE if access is to be granted and FALSE if the conditions are not met and access is not to be granted.

=OR(OR(A2="Marketing",A2="Sales"),B2="A")

Note that this is a case of nested OR functions where one OR function is used with in the other.

**Related Google Sheets Functions:**

- IF Function in Google Sheets.
- IFS Function in Google Sheets.
- IFERROR Function in Google Sheets.
- COUNTIF Function in Google Sheets.

FREE Google Sheets Tips Ebook

Get Work Done Faster with these 10 Google Sheets Tips

X