How to Use OR Function in Excel (4 Examples)

There are a number of functions in Excel to perform various logical operations easily and swiftly. Today we are going to show you how to use a logical function called OR. For the session, we are using Excel 2019, you can use your preferred version (at least Excel 2003). Now, without further ado, let’s begin.

Overview-Excel OR Function

Practice Workbook

You are welcome to download the practice workbook from the link below.

OR Function in Excel

1. Basics of OR

The OR function is categorized under Logical functions. It tests conditions and returns a boolean value.

OR- Excel OR Function

Summary

Checks whether any arguments are TRUE, and returns TRUE or FALSE. Returns FALSE only if all arguments are FALSE.

Syntax

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

Arguments

logical1: The first condition or logical value to evaluate. This is a required field.

logical2: The second condition or logical value to evaluate. It’s optional.

Versions

Workable from Excel version Excel 2003.

2. Use of OR

You can use the OR function on various occasions. Let’s explore some common usage of OR. 

I. Basic OR operation

From the definition of OR, you might have understood it compares several conditions and returns output.

Here we have a scenario of a student’s scores in a couple of courses.

Data - Excel OR Function

We will filll the remarks column using the OR function.

OR function - Excel OR Function

Here we have checked whether the score in English is greater than 70 or the Math score is equal to 100.

Paul scored 70 in English which is not greater than 70. So, this condition has not been matched. But the condition for Math has been matched. So, the final result appeared as TRUE. 

Write the same for the rest of the values.

Fill all value - Excel OR Function

You can see where any of the conditions matched the output come TRUE. And when both the conditions were unsatisfied, the result is FALSE.

II. OR Function with IF Function

Practically you will see and may need to use the OR-IF combination frequently.

In the earlier example, we have only found TRUE or FALSE, this might not provide a useful resolution. Using the IF function we can set some first glance understandable comments.

Data2 - Excel OR Function

The IF function checks the condition and returns the if_true or if_false value.

IF(logic_check, if_true, if_false)

We will provide OR as the logic of IF, and set if_true and if_false values, which will trigger depending on TRUE or FALSE.

IF-OR- Excel OR Function

Here we have used a similar OR as previous, but this time as the logic condition of IF. If our OR returns TRUE then the final result would be Did Well, Failed for FALSE.

Here for this row OR returned TRUE, so the final output was Did Well. 

Do the same for the rest of the values.

All- if - or Excel OR Function

III. OR Function for range

You can use OR in a range as well.

We have brought an imaginary dataset of a few footballer’s goals and assists to show you examples.

Data3-Excel OR Function

We will set both columns together for each player in the OR function.

=OR(logic_for_range)

OR in range - Excel OR Function

Here we have used

=OR(C5:D5>=5)

Remember this is an array formula. You need to use CTRL + SHIFT + ENTER to execute it.

We have inserted C5:D5 in OR and checked whether greater or equal to 5. If any of the values within the range satisfy the condition then the result will be TRUE. 

Do the same for the rest.

OR range - Excel OR Function

IV. OR – AND Combination

You may need to use OR with other logical functions as well. Another common logical function is AND.

We can use these two functions together. For our examples, we have chosen a basic dataset of different genres and languages.

Data4-Excel OR Function

In most cases, we need to use OR within AND. This will execute AND operation properly.

Let’s imagine we prefer Thriller or Action type, but the language has to be English. 

AND-OR- Excel OR Function

Here we have used the formula

=AND(C5="English", OR(B5="Thriller",B5="Action"))

The formula checks whether the genre is Thriller or Action in the OR function. This result can be TRUE or FALSE. Then this value stores in AND to check.

Within AND, if any of the conditions returns FALSE, then the output becomes FALSE. Both the values need to be TRUE. 

AND - OR full value - Excel OR Function

You can see there are occasions where the language was English but the genre was not matched and we found FALSE. 

Genre matched but language not matched also produced FALSE. 

3. Quick Notes

You need to keep several things in mind while using any function, and OR is no exception. Here are some honorable mentions.

I. Not using comparison operators

You may not use relational operators while using the OR function.

Number relational Excel OR Function

Here we have stored 6 in a cell and provided that within OR using cell reference.

Output - Excel OR Function

The function provided TRUE. Once you input a number (apart from 0) OR will return TRUE. 

Can you insert a text string without a relational comparison operator?

Let’s see.

text - Excel OR Function

We are changing earlier digit 6 to a text good. 

Error - Excel OR Function

It provided an error. So, you can understand that without using relational operators we cannot provide string in OR. 

II. Common Problem

Earlier we used OR for range. Sometimes there can be a mistake while using range or array in this function.

OR range - Excel OR Function

Here we have re-written the function. If we press ENTER only, then we may encounter an error.

Error - Excel OR Function

Here it arises a #VALUE! error. The function can not detect it properly so this error occurred. If you use Excel 365 then this error will not appear.

Conclusion

That’s all for today. We have tried showing how you can use the OR function in different circumstances. You can use the function from a basic operation to advanced operations. Hope you will find this helpful.

Feel free to comment if anything seems difficult to understand. Let us know any of your OR function-related scenarios where you have stuck, we are ready to help.


Further Readings

Shakil Ahmed

My name’s Shakil. My articles are targeted to support you in enriching knowledge regarding different features related to Microsoft Excel. I am fond of literature, hope some knowledge from them will help me providing you some engaging articles even though some weary technical terms.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo