How to Use AND and OR Functions in Excel (3 Practical Examples)

Get FREE Advanced Excel Exercises with Solutions!

While working in Excel, we often use the AND function. Sometimes we also use the OR function. There are times when we might need to use both the AND and OR functions together for various purposes. In this article, we will show you three suitable examples to use the AND and OR functions in Excel.


Introduction to AND and OR Functions

AND Function:

→ Syntax

=AND(logical1, [logical2],...)

→ Arguments Explanation

Arguments Required/Optional Explanation
logical1 Required 1st logical condition.
logical2 Optional 2nd logical condition.

→ Return Value

The AND function returns TRUE if all arguments inside it are TRUE, and returns FALSE if one or more arguments are FALSE.

OR Function:

→ Syntax

=OR(Logical1, [Logical2],...)

→ Arguments Explanation

Arguments Required/Optional Explanation
logical1 Required 1st logical condition.
[logical2] Optional 2nd logical condition.

→ Return Value

The OR function returns TRUE if any one of the arguments inside it is TRUE. It returns FALSE if all the arguments inside it are FALSE.

Notes
  • Both the AND and OR functions are available in Excel 2010 up to the latest version. We used Excel 2021 for this article.

How to Use AND and OR Functions in Excel: 3 Suitable Examples

In this article, we will demonstrate three suitable examples to use the AND function and the OR function in Excel. We will use the following dataset for this purpose.

excel and or function


Example 1: Check Revenue Earned from Product

In the first example, we will check if the revenue earned from a product is more than the expected amount or not. The steps are discussed in the following section.

Steps:

  • First of all, create a column and name it “Output”.
  • Next, select cell E5 and write down the following formula.
=OR(AND(C5="Printer",D5>9000),AND(C5="Headset",D5>3500))
  • Then press Enter to get the result.
Formula Breakdown
  • AND(C5=”Printer”,D5>9000) returns TRUE if cell C5 is “Printer” and Revenue Earned is greater than $9,000, otherwise, it returns FALSE.
  • AND(C5=”Headset”,D5>3500) returns TRUE if cell C5 is “Headset” and Revenue Earned is greater than $3,500.
  • =OR(AND(C5=”Printer”,D5>9000),AND(C5=”Headset”,D5>3500)) returns TRUE if one or both of the statements are true, otherwise, it returns FALSE.

Use AND and OR Functions in Excel to Check Revenue Earned from a Product

  • After that, AutoFill the formula to the rest of the cells in column E.
  • Hence, you will have your desired result.

excel and or function


Example 2: Determine Eligibility and Amount of Bonus

In this example, we will determine whether a sales representative is eligible for a bonus and how much amount of bonus he or she will receive. We will use a combination of AND and OR with the IF function in Excel for this purpose. Keep on reading to learn the steps to do so.

Steps:

  • First, select cell E5 and type the following formula.
=IF(OR(D5>=4000,AND(C5="Printer",D5>=9000))=TRUE,D5*0.1,0)
  • After that, hit Enter and you will get the result.
Formula Breakdown
  • AND(C5=”Printer”,D5>=9000) will return TRUE if cell C5 is “Printer” and Revenue Earned >= $9,000.
  • OR(D5>=4000,AND(C5=”Printer”,D5>=9000))=TRUE returns TRUE if the above statement is true or Revenue Earned from products other than the printer is greater than or equal to $4,000.
  • =IF(OR(D5>=4000,AND(C5=”Printer”,D5>=9000))=TRUE,D5*0.1,0) will return 10% of the Revenue Earned if the OR function returns TRUE, otherwise, it will return $0.

  • Finally, AutoFill the formula to the rest of column E to get the amount of bonus in all cells.

Use AND and OR Functions in Excel to Determine Eligibility and Amount of Bonus


Example 3: Calculate Results of Students

In this example, we will calculate the results of students. We will determine if a student passed or failed depending on two test scores. You can follow the procedure discussed below.

Steps:

  • Insert the following formula in cell E5.
=IF(OR(AND(C5>=60,D5>=60),C5+D5>=120)=TRUE,"Pass","Fail")
  • Then press the Enter button on your keyboard.
Formula Breakdown
  • AND(C5>=60,D5>=60) returns TRUE if scores in cells C5 and D5 both are greater than or equal to 60.
  • OR(AND(C5>=60,D5>=60),C5+D5>=120)=TRUE returns TRUE, if C5 and D5 both are greater than or equal to 60 or summation of C5 and D5, is greater than or equal to 120, otherwise, it returns FALSE.
  • =IF(OR(AND(C5>=60,D5>=60),C5+D5>=120)=TRUE,”Pass”,”Fail”) will return “Pass”, if the above statement returns TRUE. However, if it returns FALSE, the IF function will return “Fail.”

  • After that, AutoFill the formula to the rest of the cells in column E.
  • As a result, you will get your desired results for all scores.

Use AND and OR Functions in Excel to Calculate Results of Students

Notes:
  • Don’t forget to give proper cell references or you won’t get the desired result.

Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Conclusion

Thanks for making it this far. I hope you find this article useful. Now you know three examples of how to use AND and OR functions in Excel. Please let us know if you have any further queries, and feel free to give us any recommendations in the comment section below.


<< Go Back to Excel Functions | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Alif Bin Hussain
Alif Bin Hussain

Alif Bin Hussain earned a BSc in Civil Engineering from Bangladesh University of Engineering and Technology. As an engineering graduate, he has a deep passion for research and innovation. He loves to play with Excel. In his role as an Excel & VBA Content Developer at ExcelDemy, he not only solves tricky problems but also shows enthusiasm and expertise in handling tough situations with finesse, emphasizing his dedication to delivering top-notch content. He is interested in C, C++,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo