Excel OR Function

In this tutorial, we will learn about Excel about the Excel OR Function with Examples.

What is the OR function?

The OR function in Excel is used to determine if at least one condition is true for multiple situations. It will bring true value if any condition is satisfied.

The format for the OR formula:


=OR(logical1, [logical2],[logical3], …)

The Or function can have 255 for logical tests. For the OR function use you should ideally have two values.

How to use the OR function?

OR function returns TRUE if any of the conditions specified are true, and FALSE if all conditions are false. Here’s a simple explanation of how to use the OR function with a table data example:

Let’s assume you have a table in Excel with the following data in columns A and B:

Let’s say you want to check if any cell in column A or B contains a value greater than 7. You can use the OR function for this.

In a different cell (let’s say cell C1), you can use the following formula:

=OR(A1>7, B1>7)

To use the OR function on the whole data set, copy this formula to the rest of the cells in column C. This formula will show TRUE if the matching cell in column A or B is more than 7, and FALSE if not.

In the example above, the outcome in column C would be:

-

The OR function shows TRUE in the first row because B2 has a value of more than 7. The other rows show FALSE because both conditions are false for them.

IF in Excel OR function

The IF and OR functions can be combined to create more complex logical conditions in the spreadsheet of Excel.

Consider you have a table with two columns, A and B, representing test scores for two different subjects. Now you create a new column C that indicates whether a student has passed or failed based on the following conditions:

  • If the score in column A is greater than or equal to 70 OR the score in column B is greater than or equal to 70, then the student passes (output “Pass”).
  • Otherwise, the student fails (output “Fail”).

Considering your data starts from row 2, you can use the following formula in cell C2:

=IF(OR(A2>=70, B2>=70), “Pass”, “Fail”)

Excel OR Function
-

In this example, the formula checks whether the score in column A or column B is greater than or equal to 70, and assigns “Pass” or “Fail” accordingly in column C.