Excel OR Function – How To Use

Categorized as a logical function, the Excel OR function checks multiple conditions (passed as arguments) to verify whether any of the conditions turn out to be TRUE. The OR function in Excel either returns a TRUE or a FALSE. It returns FALSE only if all arguments evaluate to FALSE. The function returns TRUE even if a single argument evaluates to TRUE.

This logical function will help you compare data and test multiple conditions. Quite a helping hand, OR function has seen many days since its debut in 2003.

If you are familiar with the AND function, you will notice how similar the two functions are. As with most logical functions, the OR function has its brighter moments combined with other functions. Of course, we have the details for you, but let's cut into the simpler bits first.

Excel OR Function

Syntax

The syntax of the OR function is as follows:

=OR(logical1, [logical2], ...)

Arguments:

logical1 – The first condition to be tested.
logical2 – The second condition to be tested. Entering this argument is optional.

Important Characteristics of OR Function in Excel

  • OR function returns either "TRUE" or "FALSE" and can evaluate up to 255 conditions.
  • If an argument is the number 0, the result will be "FALSE".
  • If no logical values are found in the formula, the function returns a #VALUE! error.
  • If the formula has any typos or misspelling, the function returns a #NAME? error.
  • The arguments can be numbers, cell references, defined names, formulas, functions, or text.

Examples of OR Function

Let's put stuff to work and try to understand the function with some examples.

Example 1 – OR Function With a Single Parameter

OR function can be used with a single Boolean parameter or any expression that results in a Boolean value.

The formula simply would be:

=OR(TRUE) //returns TRUE
=OR("A"="A") //returns TRUE
=OR(1 < 5) //returns TRUE
=OR(FALSE) //returns FALSE
=OR("A"="Z") //returns FALSE
=OR(7 > 10) //returns FALSE
=OR("abc") //returns #VALUE! error

The function evaluates the condition to be logically either TRUE or FALSE and returns the relevant result. Here we have fed only one logical condition into the function. Let's move on to the effects of working in twos.

Example 2 – OR Function With Two or More Parameters

Now we will use OR function with two Boolean parameters/expressions that result in a Boolean value.

The function makes a selection based on the fulfillment of multiple conditions very easy. We'll show you how through this example.

Excel-OR-Function-Example-1

Our example is made up of marks scored by students in two tests (column C) and (column D). Students must clear at least one test to pass the subject. Passing marks for each test are 75 or more.

OR function-wise, what that means is that one condition must be fulfilled to return the result TRUE. We have applied the formula as:

=OR(C2 >= 75,D2 >= 75)

One of the values from either cell "C2" or "D2" must be at least 75 in order for the student to pass and the result to return as "TRUE".

Case 1 – When Both Parameters Evaluate to TRUE

Student "Dean Ricci" has scored 76 marks in Test 1 and 90 marks in Test 2. Both scores are above the required 75 marks. Both the conditions fed into the function are TRUE, and the result is "TRUE".

Case 2 – When Both Parameters Evaluate to FALSE

Not all students are as lucky as Dean, and as we have it, student "Preston Hall" scores 40 and 45 marks in the tests respectively. Both the conditions in the function have not been met, which means it's a "FALSE, FALSE" situation; the scores are less than75, and so the result comes as "FALSE". FALSE is returned by the OR function when all the arguments evaluate to FALSE.

Case 3 – When One Parameter is TRUE, the Other is FALSE

"Augusta Stone" has scored 84 and 45 in tests 1 and 2 respectively. As you can see, the first condition, "C6 >= 75" is met as the score is 84; that part of the function gives a TRUE result. "D6>=75" is not met since the score is 45 in test 2, and this part of the function gives a FALSE result. Since one out of the two conditions supplied to the function are met, the OR function processes this as TRUE and returns "TRUE".

Note how the result won't be TRUE and FALSE separately for the corresponding expressions; the function equates all expressions to return a single Boolean value as a result. Even though one logical condition (D6>=75) is not met, the function returns "TRUE" if any one condition is met [(C6>=75) in this case]. This means that the OR function will only result in FALSE when all the supplied parameters/expressions evaluate to FALSE. If any expression returns TRUE, the result of the OR function will be TRUE.

The same can be said for student 6; the first condition (C7>=75) is not met while the second (D7>=75) is. This has also resulted in "TRUE" by the function.

Example 3 – Use of OR Function with IF Function

The role of an IF function is to return a value based on a stated condition. IF functions can be nested within each other to develop formulas for handling complex logic.

Instead of having several nested IF functions to test multiple conditions, the OR function can be nested within the IF function to get a similar customized result.

Continuing with the example from above, we will show you how the functions work together.

Excel-OR-Function-Example-2

The plus point here of using the OR function within the IF function is that we can get:

  • "Pass" instead of "TRUE" and
  • "Fail" instead of "FALSE"

as the result.

We achieve this by the following formula:

=IF(OR(C2 >= 75,D2 >= 75),"Pass","Fail")

The OR function comes into play first. It looks up marks in cells C2 and D2 to be greater than or equal to 75. The OR function checks if any one of the conditions is met and it returns a "TRUE". The result is passed onto the IF function where the corresponding value for TRUE is "Pass"; hence IF function returns "Pass" as the result.

Example 4 – Use of OR Function in Array Form

The OR function can also be used to evaluate a range of cells and determine whether the condition specified, is met in at least one of the cells in the range. Let’s take some help from an example.

Excel-OR-Function-Example-3

In this example, we have a list of students along with their scores. Our objective is to check and see if any student on the list has scored 95 or more.

To accomplish this, we can make use of the OR function in array form as:

{=OR(C2:C11 >= 95)}

Note: This is an array formula and must be entered with Ctrl + Shift + Enter keys, except in Excel 365.

In the above formula, we are asking the OR function to take each cell in the given range i.e. C2:C11, and check if the value in any one of the cells is greater than or equal to 95. If even a single cell in the range has a value greater than or equal to 95, the function returns TRUE otherwise it returns FALSE.

Since in our case student 2 "Disha Varma" has a score of 95, hence the condition is satisfied and the OR function returns a TRUE.

It's a wrap! You can alt + f4 now "or" you can read on.

Here's an Excel joke for you:

What if you clicked undo so many times

IT TURNED BACK INTO EXCEL 2.0

We'll let you sit with that one while we prep another Excel function (without so many undos).

About Ankit Kaul

Well, I am Ankit Kaul, the founder of Excel Trick. I am a die-hard fan of Microsoft Excel and have been working with spreadsheets for the past 10+ years. My only aim is to turn you guys into 'Excel Geeks'. Check out more about me here.