Thr Excel OR Function
The OR function tests conditions and returns a boolean value.
- Objective
Checks whether the arguments are TRUE, and returns TRUE or FALSE.
- Syntax
=OR(logical1,[logical2], ...)
- Arguments
Argument | Required/Optional | Explanation |
---|---|---|
logical1 | Required | The first condition or logical value to evaluate. |
[logical2] | Optional | The second condition or logical value to evaluate. |
- Returning Parameter
Logical values- TRUE or FALSE, depending on whether at least one of the logical arguments is TRUE .
Example 1 – Using the Basic OR Function in Excel
This is the sample dataset.
To fill the remarks column:
Steps:
- Select E5.
- Enter the following formula:
=OR(C5>70,D5=100)
- Press Enter.
- Select the cell again.
- Drag down the Fill Handle to see the result in the rest of the cells.
The formula checks whether the score in English is greater than 70 or the Math score is equal to 100. It returns TRUE. if the are met. Otherwise, FALSE.
Example 2 – Combining the OR and the IF Functions
Steps:
- Select E5.
- Enter the following formula:
=IF(OR(C5>70,D5=100),"Did Well","Failed")
- Press Enter.
- Select the cell again.
- Drag down the Fill Handle to see the result in the rest of the cells.
The IF function can take three arguments- a condition, a value to return if the condition is TRUE, and a value to return otherwise.
Example 3 – Use the OR function with a Range in Excel
This is the sample dataset.
Steps:
- Select E5.
- Enter the following formula:
=OR(C5:D5>=5)
- Press Enter.
- Select the cell again.
- Drag down the Fill Handle to see the result in the rest of the cells.
Example 4 – Combining the OR and the AND Function
This is the sample dataset.
To find Thriller or Action films in English:
Steps:
- Select D5.
- Enter the following formula:
=AND(C5="English",OR(B5="Thriller",B5="Action"))
- Press Enter.
- Select the cell again.
- Drag down the Fill Handle to see the result in the rest of the cells.
Things to Remember
- Do not use comparison operators or insert text values in the OR function. It will return a #VALUE error.
Download Practice Workbook
Download the workbook.
<< Go Back to Excel Functions | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!