How to Check Whether Condition1 OR Condition2 Are Met in Excel

Sometimes, you may want to check whether one of two conditions is met in Excel. For example, you may want to know if a student has passed either math or science, or if a product has sold more than 100 units or has a profit margin above 20%. In this article, we will show you how to use the OR function in Excel to check whether condition1 or condition2 are met.

What is the OR Function?

The OR function is a logical function that returns TRUE if any of the arguments are TRUE, and FALSE if all of the arguments are FALSE. The syntax of the OR function is:

=OR(logical1, [logical2], ...)
  • logical1 is the first condition to test. It can be a logical expression, a cell reference, or a value that can be evaluated as TRUE or FALSE.
  • logical2, … are optional additional conditions to test. You can have up to 255 arguments in the OR function.

How to Use the OR Function

To use the OR function, you need to enter it in a cell and provide the conditions that you want to check. For example, if you want to check whether A1 is greater than 10 or B1 is less than 5, you can enter the following formula in C1:

=OR(A1>10, B1<5)

This formula will return TRUE if either A1 is greater than 10 or B1 is less than 5, and FALSE otherwise.

You can also use cell references or ranges as arguments in the OR function. For example, if you want to check whether any of the values in A1:A10 are equal to “Yes”, you can enter the following formula in B1:

=OR(A1:A10="Yes")

This formula will return TRUE if any of the cells in A1:A10 contain the text “Yes”, and FALSE otherwise.

You can also nest other functions inside the OR function, such as IF, AND, NOT, etc. For example, if you want to check whether A1 is either blank or contains a number, you can enter the following formula in B1:

=OR(ISBLANK(A1), ISNUMBER(A1))

This formula will return TRUE if A1 is either blank or contains a number, and FALSE otherwise.

Example: Checking Whether a Student Has Passed Either Math or Science

Let’s say you have a table of students’ grades in math and science, and you want to check whether each student has passed either math or science. You can use the OR function to do this. Assume the table is in A1:C6, where A1 contains the header “Name”, B1 contains the header “Math”, and C1 contains the header “Science”. The passing grade for both subjects is 60. To check whether a student has passed either math or science, you can enter the following formula in D2 and copy it down to D6:

=OR(B2>=60, C2>=60)

This formula will return TRUE if the student has passed either math or science, and FALSE otherwise. The result will look like this:

Table

Name Math Science Passed Either
Alice 75 65 TRUE
Bob 55 70 TRUE
Carol 60 60 TRUE
David 50 50 FALSE
Eve 80 40 TRUE

Other Approaches

Besides using the OR function, you can also use other approaches to check whether condition1 or condition2 are met in Excel. Here are some alternatives:

  • You can use the + operator to add the logical values of the conditions, and compare the result with 1. For example, the formula =OR(B2>=60, C2>=60) is equivalent to =(B2>=60)+(C2>=60)=1.
  • You can use the MAX function to find the maximum value of the conditions, and compare the result with a threshold. For example, the formula =OR(B2>=60, C2>=60) is equivalent to =MAX(B2,C2)>=60.
  • You can use the IF function to return different values based on the conditions, and compare the result with a criterion. For example, the formula =OR(B2>=60, C2>=60) is equivalent to =IF(B2>=60,"Pass","Fail")="Pass".

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *