How to Use OR Function in Excel (4 Ideal Examples)

Get FREE Advanced Excel Exercises with Solutions!

Fortunately, 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 the Excel OR function. For the session, we are using Microsoft Office 365. However, you can use your preferred version (at least Excel 2003). In this article, I will show you 4 ideal examples to use the OR function in Excel. Now, without further ado, let’s begin.


Introduction to Excel OR Function

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

OR Function in Excel

  • Objective

Checks whether any arguments are TRUE, and returns TRUE or FALSE. Returns FALSE only if all arguments are 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 or not.

  • Version

Excel 2003 version and above.


How to Use OR Function in Excel: 4 Ideal Examples

Usually, you can use the OR function on various occasions. Let’s explore some common usage of OR. Moreover, we will be using different datasets for different examples. However, keep in mind that these are just some basic examples to demonstrate the usage of the function in different scenarios. At the same time, the usage of the function can go a long way in developing useful formulas for automation.


1. Basic OR Function in Excel

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

Sample Dataset for Basic OR Function in Excel

We will fill the remarks column using the OR function in Excel. Here, we will check whether the score in English is greater than 70 or the Math score is equal to 100. However, Paul scored 70 in English which is not greater than 70. So, this condition is not a match. But the condition for Math is a match. So, the final result should appear as TRUE. Hence, follow these steps to see how we can do that.

Steps:

  • First, select cell E5.
  • Then write down the following formula in it.

=OR(C5>70,D5=100)

  • After that, press Enter.

Basic OR Function in Excel

  • Now select the cell again and click and drag the Fill Handle icon to the end of the column to replicate the formula for the rest of the cells.

You can see where any of the conditions matched the output came TRUE. And when both conditions were unsatisfactory, the result was FALSE. And we have done that using just the OR function in Excel.


2. Combination of OR and IF Functions

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. This function can take three arguments- a condition, a value to return if the condition is TRUE, and a value to return otherwise. Hence, follow these steps to see how we can do that.

Steps:

  • First of all, select cell E5.
  • Now write down the following formula.

=IF(OR(C5>70,D5=100),"Did Well","Failed")

  • After that, press Enter.

Combination of OR and IF Function in Excel

  • Next, select the cell again. Then click and drag the Fill Handle icon down to fill the rest of the cells with the formula.

Thus, we can easily combine the IF function with the OR function in Excel to create the desired output.


3. Apply OR for a Range in Excel

You can use OR in a range as well. Let’s spice things up with a different dataset this time. However, you can do the same for the previous one as well. For the purpose of demonstration, we will use the following dataset this time.

Sample Dataset for Apply OR for a Range in Excel

We will be following these steps to calculate the OR function in Excel, but this time, for a range.

Steps:

  • In the beginning, select cell E5.
  • Then write down the following formula in it.

=OR(C5:D5>=5)

  • Now press Enter.

  • Finally, select the cell again. Then click and drag the Fill Handle icon down.

Thus, we can apply the OR function in Excel to a range at a time.


4. Combine OR with AND Function

Furthermore, you may need to use OR with other logical functions as well. Another common logical function is the AND function. Let’s try yet another dataset for that as well. We have chosen the following.

In most cases, we need to use OR within AND. This will execute the AND operation properly. Let’s imagine we prefer the Thriller or Action type, but the language has to be English. Go through the steps to see how we can achieve that.

Steps:

  • First, select cell D5.
  • Second, insert the following formula.

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

  • Third, press Enter.

Combine OR with AND Function in Excel

  • After that, select the cell again.
  • Finally, click and drag the Fill Handle icon down to fill up the cells with formulas with respective references.

And that is how we can combine the AND function with the OR function in Excel and get results of unique scenarios.


Things to Remember

  • Initially, do not use comparison operators and do not insert text values in the OR. Otherwise, it will result in a #VALUE error.
  • Meanwhile, inserting just a number in the function as an argument will give us TRUE as output.
  • Lastly, prior to Excel 365, if you use an array such as C5:D5 as a part of an argument in the function for a single cell value, it may also sometimes cause an error.

Download Practice Workbook

You can download the workbook used for the demonstration from the link below.


Conclusion

So that was all about the OR function in Excel. Hopefully, you have grasped the idea of using the function and constructing formulas out of it with other functions. I hope you found this guide helpful and informative. If you have any questions or suggestions, let us know in the comments below.


<< Go Back to Excel Functions | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Shakil Ahmed
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

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo