OR in Excel ( Table of Contents)
OR Excel Function
The Microsoft Excel OR function is a logical function in excel to test different conditions in the meantime. This logical function helps you in comparing two values or statements in excel. OR in Excel, on the other hand, returns either TRUE or FALSE. OR function will return TRUE if at least any one of the arguments or conditions evaluates as TRUE. Similarly, it will also return FALSE, if all the arguments or conditions are FALSE. The OR in Excel can be utilized as the logical test inside the IF function for avoiding extra nested IFs and can be also be used in combination with the AND function.
OR Excel Formula
Explanation of OR Function in Excel
The OR in Excel accepts the following parameters and arguments:
- Logical1– Required. This is referred to as a condition for testing that can be either TRUE or FALSE.
- Logical2, …Logical_n – [Optional]. Conditions for testing can either be TRUE or FALSE. There can be a total of 255 conditions (in modern excel versions).
- Return Value: The return value will be TRUE if any of the arguments is true, otherwise the return value will be FALSE.
How to Use the OR Function in Excel?
Let’s understand the examples of OR function in Excel.
- You can simply enter the desired OR Excel formula in the required cell to attain a return value on the argument.
- You can manually open the OR Excel formula dialogue box in the spreadsheet and enter the logical values to attain a return value.
- From the above spreadsheet, you can see the Formulas Section in the Menu Bar. Under the Formulas Section, Click on the Logical tab and select OR.
- The above OR Excel function dialogue box will open, where you can easily put the arguments in the logical1, logical2 and so on and attain a return value. Consider the example below.
OR Excel Formula and Explanation
Here are few formulas for you to understand the OR in Excel and its working.
|=OR (A2=“Bananas”,A2=“Oranges”)||It will return TRUE if A2 contains either Bananas or Oranges, otherwise FALSE.|
|=OR(B2>=50,C2>=25)||It will return TRUE if B2 is greater than or equal to 50 or C2 is greater than or equal to 25, otherwise FALSE.|
|=OR(B2= “ ”,C2=“ ”)||It will return TRUE if either B2 or C2 is left blank, otherwise FALSE.|
Look at the spreadsheet below to get a detailed idea of the above formulas.
Below you can see three OR Excel formula sections from the above table, Formula 1, Formula 2 and Formula 3, which are as follows-
Formula 1 – = OR(An= “Bananas”,An=”Oranges”)
Formula 2 – = OR(Bn>=50,Cn>=25)
Formula 3 – = OR(Bn= “ ”,Cn= “ ”)
Where n=cell number in the spreadsheet
How to Use OR Function in Excel with Examples
Let’s look below at some of the examples of OR function in Excel. These examples will help you in exploring the use of OR function in Excel.
Based on the above Excel spreadsheet, let’s consider three examples and see the OR Excel function return based on the syntax of the function.
OR in Excel Example #1
When the OR Excel formula is written is =OR(A1<10, A1=40)
You can see the excel spreadsheet below:
OR in Excel Example #2
When the formula is written is =OR(A1=45, A2=“Google”)
Consider the excel spreadsheet below:
OR in Excel Example #3
When the OR Excel formula written is =OR(A1>=5,A1=25,A2= “e2esols.com”)
Look at the spreadsheet below to understand the above example.
In Combination with the AND and IF function
The AND and OR Excel function are the well-known logical functions of excel spreadsheets, and what these two functions do is to test to see whether the result from at least two target cells meets conditions that you determine. These functions will only return one of the two results, which you can also call Boolean values: TRUE or FALSE.
- For the OR Excel function – row 2 above – various conditions are tested and if any of the tested conditions is valid, at that point the OR Excel function return value is TRUE. Just if all conditions are not genuine will OR give you a FALSE return value.
- For the AND Function – row 3 above – different conditions are tested and just if the majority of the conditions are genuine will the function give a return value TRUE. If not, the function returns FALSE as the return value.
The OR and AND function can be combined with other excel functions such as the IF function. In the above example, you can see the rows four and five have been combined with IF function, to get a variety of results.
Working of OR and AND Function in Excel
Let’s see the working of the functions –
In the above image, you can see cells B2 and B3 are containing AND and OR in Excel respectively. To test different conditions or a variety of results, both the AND and OR Excel function use numbers of comparison operators in this example.
The two functions used above are –
The conditions which they test are as follows –
- The data in cell A2 is less than 50 (<is the symbol for less than).
- The data in cell A3 is not equal to 75 (<>is the symbol of not equal to).
- The data in cell A4 is greater than or equal to 100 (>=is the symbol for greater than or equal to).
Things to Remember About the OR function in Excel
- The OR function in Excel is a logical function of excel which is used to test two or more conditions or arguments at the same time.
- The return value OR Excel function is either TRUE or FALSE.
- The return value depends on the arguments which you input in the OR Excel formula.
- There can be a total of 255 conditions or arguments to be tested at the same time through OR Excel function.
- OR Excel function can be combined with other logical functions such as AND or IF.
This has been a guide to OR Function in Excel. Here we discuss the OR Formula in excel and how to use OR function along with excel example and downloadable excel templates. You may also look at these useful functions in excel –