Excel OR Function | Most useful Excel functions
When working with Excel, sometimes you need to decide whether to perform an action or not. In these cases, Excel logical functions come in handy.
OR is one of these functions, and we are going to discuss it in this tutorial.
Excel Logical Functions
First things first, let’s see what logical functions are in Excel and what they do.
We use the logical functions in Excel to test whether a condition is true or false. They allow us to check a cell’s content or perform an action such as a calculation or further tests.
Excel provides eleven logical functions. Some of these functions check if a condition is true or false and return either TRUE or FALSE; some can take a command such as a formula to run based on the conditions. They can also combine multiple conditions.
Enhance your business efficiency with our specialized Macro Development Services, tailored to automate and streamline your operations for maximum productivity.
Excel OR Function
Excel OR function is a basic logical function that is used to compare two or more conditions. Like the other logical functions, it returns either TRUE or FALSE. Now, let’s see how it works.
The syntax of the function is as below:
=OR(logical1, [logical2], …)
As you can see in the function’s syntax, it takeslogical values as input arguments. In fact, the arguments are conditions in a test which we want to compare.
If at least one of the conditions is TRUE, the OR function returns TRUE as the result. Otherwise, it returns FALSE.
Helpful Notes about the OR Function
- Like the other logical functions in Excel, the OR function can take numbers as input arguments. It evaluates zero as FALSE and other numbers as TRUE.
- The function ignores empty cells if used as input arguments.
- If the function cannot evaluate an argument as a logical value, it returns the VALUE error.
Example: look at the image below to see how the function works:
OR as an Array Formula
Sometimes, you need to compare a large number of cells. In this case, you have to use OR in an array formula.
Imagine you have a dataset of growth percentage in your products’ prices, and you want to know if any of them has grown at least 90%.To find this out, type “=OR(D2:D15>=90)” and press Alt+Ctrl+Enter.
Note: If you do not enter the formula as an array formula, the function will return FALSE unless you type it in the same row as the cell that has a value more than or equal to 90.
Enhance your productivity and efficiency with our comprehensive Excel Automation Services, designed to simplify complex tasks and save you valuable time.
Combination of OR Function with Other Logical Functions
As we mentioned earlier, the logical functions get the logical values as arguments and return logical values (except for the IF function). So, we can always combine them to make decisions about more complex conditions.
A few examples of combining the OR function with other logical functions are brought below.
Combination of OR and AND Functions
Like the OR function, the AND function returns a logical value. If all of the arguments are true, it returns TRUE, otherwise FALSE. So we can use the AND function as an argument in OR function and vice versa.
Example: Assume that you want to find out the amount of money Kasper has earned by selling and any other one who earned between 60000 to $80000.
The following formula will get it out.
=OR(AND(B2>=60000,B2<=80000),A2="Kasper")
As another example, assume that you want Fords sold by Andreas and Kasper from the data.
The formula below will do the job.
=AND(OR(A2="Andreas",A2="Kasper"),B2="Ford")
IF OR Statement
Using the IF function, you can test a condition and make a decision to return a result if the condition is true or false. Now, if you want to test multiple conditions and just one of them being true is enough, you can use the OR function inside the IF function.
Example1: assume that you want to characterize a number of materials using three tests, i.e., XRD, FTIR, and SEM. If you apply all three, you can determine if they are synthesized correctly.
The formula below returns “not enough” if you have applied all three characterization tests and returns nothing if at least one of them has not been done yet.
=IF(OR(B2="",C2="",D2=""),"not enough","")
Example2: You can also do a calculation to get a result.
Imagine that you want to calculate the commission you have to pay to your agents. If they have sold more than 90000 dollars or made more than 20 percent profit, you want to pay them 50 percent of the whole money they earned. If not, they will get 25 percent.
So you use the OR function to see if they meet at least one of the conditions as below:
=IF(OR(B2>90000,C2>20),B2*0.01*C2*0.5,B2*0.01*C2*0.25)
FAQ
An operator is a symbol that does a calculation or a comparison between data. Operators do not take arguments in Excel, while functions take at least one argument. Excel has four types of operators: arithmetic, comparison, text, and reference.
The OR function is a logical function in Excel that takes logical values as arguments and returns either TRUE or FALSE.
The OR function takes up to 255 logical conditions as arguments; each must be either TRUE or FALSE or translated as TRUE or FALSE.
You use the OR function to see if at least one of the given conditions is true; you use the AND function to see if all of your conditions are true at the same time.
Bottom Line
In this blog, we introduced the OR function, which is proven to be one of the useful logical functions provided by Excel. Now, you have gained more insight on how to use the function properly and combine it with other functions, as we explained.
You can connect with us and make inquiries to get more Excel Support services.
Reduce cost, accelerate tasks, and improve quality with Excel consulting services.
Our experts will be glad to help you, If this article didn't answer your questions.
We believe this content can enhance our services. Yet, it's awaiting comprehensive review. Your suggestions for improvement are invaluable. Kindly report any issue or suggestion using the "Report an issue" button below. We value your input.