The OR function in Excel is found in the formulas tab under “logical.” It checks whether any of the arguments are true and will yield either a true or false value. In our Excel classes, you will learn the functionality of this feature and many others.
The syntax or formula is: =OR(logical1,logical2,logical3,…)
The OR function in Excel can be used with logical operators, nested within an “if” function, and used in conjunction with the “and” or “not” functions. This Excel tutorial will teach you the finer points of using the OR function in your daily life as you work with the program.
How Can I Use the OR Function in Excel With Logical Operators?
It’s the end of the year and employee bonuses are being distributed. The first bonus is a sales bonus and it is awarded to every employee who either had over $10,000 in sales or sold more than 10 protection plans.
- Logical1 =B2>10000
- Logical2 =C2>10
- Copy the formula down Column F
- All employees who have a TRUE will get the sales bonus this year.
How to Use the “if” Function in Excel
To change the value in column F to show the actual bonus ($250.00) instead of the true or false values, use an “if” function. Continue reading this portion of your Excel training to better understand the differences between “if” and OR.
- Insert the OR Function from the example above into an if Function as the logical_test.
- The function reads if the employee has sales exceeding $10,000 or has sold more than 10 protection plans return $250, if not $0.
Copy down the column and now you can see exactly who gets a bonus.
Use when there is multiple criterion, a concept that will be frequently made mention of during our online Excel course. For example, a training bonus of $25 is issued to all employees who had either 8 hours or 16 hours only if the employee was absent less than 2 days.
- Enter the OR function as =OR(D2=8,D2=16)
- Nest the OR function into an and function as =AND(OR(D3=8,D3=16),E3<2)
- Nest the and Function into the if Function as =IF(AND(OR(D4=8,D4=16),E4<2),”$25″,”$0″)
- The final formula reads if training hours equal 8 OR 16 and days missed is under 2, then return a value of $25 if not, no bonus is awarded.
How Can I Use the “not” Function with the OR Function in Excel?
The not function changes false to true or true to false. When combined with the OR Function it searches for values that are not this or that. The company gives gift cards out at the end of the year. Employees who did not receive a training bonus nor a sales bonus will receive a $10 Gift Card as a thank you from the owner. Quality Excel classes will help you learn to configure these kinds of spreadsheets and effectively manipulate the data to your needs.
- Create the OR Statement =OR(F2=”$250″,G2=”$25″), a true value means the employee received a sales bonus and/or a training bonus.
- Nest the OR statement into a not function =NOT(OR(F2=”$250″,G2=”$25″)) to search for those that didn’t receive either bonus.
- Nest the not function inside an if function =IF(NOT(OR(F2=”$250″,G2=”$25″)),”$10″,””) this function reads If the employee didn’t receive either bonus, place a $10 in the cell, if they did receive a bonus leave the cell blank (told by the “” in the value_if_false element).
How Can I Combine Multiple Nests with the OR Function in Excel?
Continuing with the above example, let’s say employees who received one bonus receive a $25 gift card and those that earned both bonuses receive a $100 gift card at the end of the year.
- Create an and function =AND(F2=”$250″,G2=”$25″) to check if the employee received both bonuses.
- Nest the and function within an if function IF(AND(F2=”$250″,G2=”$25″),”$100″,”$25″) to see if they did receive both return a value of $100. If not, return a value of $25.
- Nest the if function above into the value_if_false condition of the original IF Function IF(NOT(OR(F2=”$250″,G2=”$25″)),”$10″,IF(AND(F2=”$250″,G2=”$25″),”$100″,”$25″))
- The logic in this very large function is first check if the employee did not receive a bonus and leaving a $10 value. If they did it is not looking to see if they received both and leaving a $100, the only other option is for the employee to receive one bonus and in that case, it is leaving a value of $25.
- Working backwards is the best way to ensure your nested functions remain intact and operable. In the above worksheet, I test each function one by one in column J. If the function worked properly I delete the equal sign from the front, go to the next row and copy the function into the next logical test. The individual functions are coloured to show how they fit within each other.
These quick Excel Lessons should help you with the OR function in Excel. If you still do not fully understand the concept, additional online Excel training might be in order.
Excel Classes Will Teach You All of the Functions in a Way That You Can Understand
The program comes complete with numerous functions that you must understand if you want to get the most out of Microsoft Excel. Our comprehensive Excel classes will teach you the applications of these functions in a way that you can practice them effectively in your daily professional life.