OR Excel Function (Table of Contents)
OR in Excel
OR Function is a logical function which compares two values or statements in a defined cell. OR function helps in testing the conditions defined or given.
The result of OR Function will either TRUE or FALSE, as per the condition. It will result in TRUE if any of the condition or argument evaluates match the given condition. If the condition will not match then it will return as a FALSE.
OR Formula in Excel
Below is the OR Formula:
What OR Function actually does?
It returns TRUE, if any argument matches or true, it returns FALSE if all arguments are false.
When to use OR Function?
OR Function can be used when we want to check multiple conditions in a defined cell.
- Logical1 – the condition which we want to evaluate, it can be TRUE or FALSE (first condition)
- Logical2 – This condition is the optional, second condition which we want to evaluate for TRUE or FALSE.
How to Open OR Function in Excel?
Click on Formula Tab > Logical> Click on OR
How to Use OR Function in Excel?
This OR Function is very simple and easy to use. Let us now see how to use OR in Excel with the help of some examples.
- We can manually enter by using Formula dialogue box and enter the required logical values or conditions according to the requirement in the spreadsheet.
After clicking OR we can enter the logic in below box, make sure the logic should be in a correct format and written between” ”. So that it can return to a correct result like below.
We can see it returned as FALSE because as entered in logic A2 is neither Orange nor Red, so the result is FALSE.
- The other option is to enter the OR formula in the required cell with correct syntax, to return a value according to the argument.
As we can see in below example that the argument came as TRUE because the logic which is given below formula that A2 is greater than 50 but it does not match, however, the other logic is A2 is greater than 10, hence it came as TRUE because if any of the logic is correct or match then it will come as TRUE.
We can also use OR with IF function, suppose marks of students are given for English and Science if English marks is above 50 and Science is above 48 then we want to be considered as a pass for the given students.
As we can see in below screenshot, that Roll no. 102 & 106 has less no. in both subjects as per the argument or condition, that is why they are considered as FAIL. Roll no. 102 have 26 marks in English & 20 marks in Science and required is 50 & 48, respectively, hence the result is FAIL. Same with Roll no. 106.
Sometimes, we have to highlight or to know the dates that is weekends, depends on the requirement. In this case, we can use the OR and WEEKDAY functions. For example, we can take the data given below:
The below formula used the WEEKDAY function firstly to test for the entire days whether it is Saturday or Sunday. If given a date, WEEKDAY function returns a number 1-7, for every day of the week. With the configuration given, Saturday is 7 and Sunday is 1. With the OR function, we have used WEEKDAY to test for either 1 or 7. If either is true, the formula gives us and return as TRUE and will trigger the conditional formatting.
Sometimes, we have to highlight the entire row, then we have to apply the conditional formatting to all the table and have to lock the date column. Then, it will give us the desired result for the whole data. We have to lock it by using $ or pressing F4 near cell address in the formula. The formula should be like this: =OR(WEEKDAY($B2)=7,WEEKDAY($B2)=1) .
Below pic is with conditional formatting formula, that is why weekend gets highlighted i.e. Saturday and Sunday:
Things to Remember About OR Function in Excel
- The OR function can also be combined with AND and IF.
- The return value of OR Function is TRUE or FALSE.
- The OR function is used to test two or more condition or arguments at a time.
- The value or result depends upon the logic or arguments given.
- The maximum number of conditions or arguments can be 255 which applied at the same time in OR function.
- The OR Function will give a result as #VALUE if there is no logic found in the formula or arguments.
- The text values or empty cells supplied as arguments, then ignored.
You can download this OR function Excel template here – OR Function Excel Template
This has been a guide to OR in Excel. Here we discuss the OR Formula and how to use OR Function in Excel along with practical examples and downloadable excel template. You can also go through our other suggested articles –