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 Excel 2019, you can use your preferred version (at least Excel 2003). Now, without further ado, let’s begin.
Practice Workbook
You are welcome to download the practice workbook from the link below.
Excel OR Function
1. Basics of OR Function
The OR function is categorized under Logical functions. It tests conditions and returns a boolean value.
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 Function
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.
We will fill the remarks column using the 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.
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.
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.
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.
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.
We will set both columns together for each player in the OR function.
=OR(logic_for_range)
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.
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.
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.
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.
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.
Here we have stored 6 in a cell and provided that within OR using cell reference.
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.
We are changing earlier digit 6 to a text good.
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.
Here we have re-written the function. If we press ENTER only, then we may encounter an error.
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
- How to use IFERROR Function in Excel (3 Examples)
- How to Use NOT Function in Excel (With 8 Examples)
- How to Use IFS Function in Excel (2 Examples)
- How to Use TRUE Function in Excel (With 10 Examples)
- How to Use FALSE Function in Excel (With 5 Easy Examples)
- How to Use XOR Function in Excel [With Example]