Can you use and in excel if statement

The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and returning a result if that condition is True or False.

  • =IF(Something is True, then do something, otherwise do something else)

But what if you need to test multiple conditions, where let’s say all conditions need to be True or False (AND), or only one condition needs to be True or False (OR), or if you want to check if a condition does NOT meet your criteria? All 3 functions can be used on their own, but it’s much more common to see them paired with IF functions.

Use the IF function along with AND, OR and NOT to perform multiple evaluations if conditions are True or False.

Syntax

  • IF(AND()) — IF(AND(logical1, [logical2], …), value_if_true, [value_if_false]))

  • IF(OR()) — IF(OR(logical1, [logical2], …), value_if_true, [value_if_false]))

  • IF(NOT()) — IF(NOT(logical1), value_if_true, [value_if_false]))

Argument name

Description

logical_test (required)

The condition you want to test.

value_if_true (required)

The value that you want returned if the result of logical_test is TRUE.

value_if_false (optional)

The value that you want returned if the result of logical_test is FALSE.

Here are overviews of how to structure AND, OR and NOT functions individually. When you combine each one of them with an IF statement, they read like this:

  • AND – =IF(AND(Something is True, Something else is True), Value if True, Value if False)

  • OR – =IF(OR(Something is True, Something else is True), Value if True, Value if False)

  • NOT – =IF(NOT(Something is True), Value if True, Value if False)

Examples

Following are examples of some common nested IF(AND()), IF(OR()) and IF(NOT()) statements. The AND and OR functions can support up to 255 individual conditions, but it’s not good practice to use more than a few because complex, nested formulas can get very difficult to build, test and maintain. The NOT function only takes one condition.

Examples of using IF with AND, OR and NOT to evaluate numeric values and text

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(AND(A2>0,B2<100),TRUE, FALSE)

IF A2 (25) is greater than 0, AND B2 (75) is less than 100, then return TRUE, otherwise return FALSE. In this case both conditions are true, so TRUE is returned.

=IF(AND(A3=»Red»,B3=»Green»),TRUE,FALSE)

If A3 (“Blue”) = “Red”, AND B3 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case only the first condition is true, so FALSE is returned.

=IF(OR(A4>0,B4<50),TRUE, FALSE)

IF A4 (25) is greater than 0, OR B4 (75) is less than 50, then return TRUE, otherwise return FALSE. In this case, only the first condition is TRUE, but since OR only requires one argument to be true the formula returns TRUE.

=IF(OR(A5=»Red»,B5=»Green»),TRUE,FALSE)

IF A5 (“Blue”) equals “Red”, OR B5 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case, the second argument is True, so the formula returns TRUE.

=IF(NOT(A6>50),TRUE,FALSE)

IF A6 (25) is NOT greater than 50, then return TRUE, otherwise return FALSE. In this case 25 is not greater than 50, so the formula returns TRUE.

=IF(NOT(A7=»Red»),TRUE,FALSE)

IF A7 (“Blue”) is NOT equal to “Red”, then return TRUE, otherwise return FALSE.

Note that all of the examples have a closing parenthesis after their respective conditions are entered. The remaining True/False arguments are then left as part of the outer IF statement. You can also substitute Text or Numeric values for the TRUE/FALSE values to be returned in the examples.

Here are some examples of using AND, OR and NOT to evaluate dates.

Examples of using IF with AND, OR and NOT to evaluate dates

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(A2>B2,TRUE,FALSE)

IF A2 is greater than B2, return TRUE, otherwise return FALSE. 03/12/14 is greater than 01/01/14, so the formula returns TRUE.

=IF(AND(A3>B2,A3<C2),TRUE,FALSE)

IF A3 is greater than B2 AND A3 is less than C2, return TRUE, otherwise return FALSE. In this case both arguments are true, so the formula returns TRUE.

=IF(OR(A4>B2,A4<B2+60),TRUE,FALSE)

IF A4 is greater than B2 OR A4 is less than B2 + 60, return TRUE, otherwise return FALSE. In this case the first argument is true, but the second is false. Since OR only needs one of the arguments to be true, the formula returns TRUE. If you use the Evaluate Formula Wizard from the Formula tab you’ll see how Excel evaluates the formula.

=IF(NOT(A5>B2),TRUE,FALSE)

IF A5 is not greater than B2, then return TRUE, otherwise return FALSE. In this case, A5 is greater than B2, so the formula returns FALSE.

Example of the Evaluate Formula Wizard

Using AND, OR and NOT with Conditional Formatting

You can also use AND, OR and NOT to set Conditional Formatting criteria with the formula option. When you do this you can omit the IF function and use AND, OR and NOT on their own.

From the Home tab, click Conditional Formatting > New Rule. Next, select the “Use a formula to determine which cells to format” option, enter your formula and apply the format of your choice.

Conditional Formatting > Edit Rule dialog showing the Formula method

Using the earlier Dates example, here is what the formulas would be.

Example of using AND, OR and NOT as Conditional Formatting tests

Formula

Description

=A2>B2

If A2 is greater than B2, format the cell, otherwise do nothing.

=AND(A3>B2,A3<C2)

If A3 is greater than B2 AND A3 is less than C2, format the cell, otherwise do nothing.

=OR(A4>B2,A4<B2+60)

If A4 is greater than B2 OR A4 is less than B2 plus 60 (days), then format the cell, otherwise do nothing.

=NOT(A5>B2)

If A5 is NOT greater than B2, format the cell, otherwise do nothing. In this case A5 is greater than B2, so the result will return FALSE. If you were to change the formula to =NOT(B2>A5) it would return TRUE and the cell would be formatted.

Note: A common error is to enter your formula into Conditional Formatting without the equals sign (=). If you do this you’ll see that the Conditional Formatting dialog will add the equals sign and quotes to the formula — =»OR(A4>B2,A4<B2+60)», so you’ll need to remove the quotes before the formula will respond properly.

Need more help?

Connect with an expert. Learn from live instructors.​​​​​​​

See also

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Learn how to use nested functions in a formula

IF function

AND function

OR function

NOT function

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

Keyboard shortcuts in Excel

Logical functions (reference)

Excel functions (alphabetical)

Excel functions (by category)

Home / Excel Formulas / How to Combine IF and AND Functions in Excel

As I told you, by combining IF with other functions you can increase its powers. AND function is one of the most useful functions to combine with the IF function.

Like you combine IF and OR functions to test multiple conditions. In the same way, you can combine IF and AND functions.

There is a slight difference in using OR, and AND functions with IF. In this post, you will learn to combine IF & AND functions and you will also learn why we need to combine both of these.

Quick Intro

Both of these functions are useful but by using them jointly, you can solve some real-life problems. Here is a quick intro for both.

  1. IF Function – To test a condition and return a specific value if that condition is true or another specific value if that condition is false.
  2. AND Function – To test multiple conditions. If all the conditions are true then it will return true and if any of the conditions are false then it will return false.

Why is this Important?

  1. You can test more than one condition with the IF function.
  2. It will return a specific value if all the conditions are true.
  3. Or, it will return another specific value if any of the conditions are false.

How do IF and AND Functions Work?

To combine IF and AND functions you have to just replace the logical_test argument in the IF function with AND function. By using AND function you can specify more than one condition.

how to combine if and and functions replace logical test

Now AND function will test your all conditions here. If all the conditions are true then AND function will return true and the IF function will return the value which you have specified for true.

And, if any of the conditions is false then AND function will return false, and the IF function will return the value which you have specified for false. Let me show you a real-life example.

Examples

Here I have a marks sheet of students. And, I want to add some remarks to the sheet.

how to combine if and and functions table to add status

If a student is passed both of the subjects with 40 marks or above, the status should be “Pass”. And, if a student has less than 40 marks in both of the subjects or even in one subject, the status should be “Fail”. The formula will be.

=IF(AND(B2>=40,C2>=40),"Pass","Fail")
how to combine if and and functions insert formula

In the above formula, if there is a value 40 or greater than in any of the cells (B2 & C2) AND function will return true, and IF will return the value “Pass”. That means if a student passed both of the subjects then he/she will pass.

But, if both cells have a value lower than 40 then AND will return false, and IF will return the value “Fail”. If a student is failed in any of the subjects he/she will fail.

Download Sample File

  • Ready

And, if you want to Get Smarter than Your Colleagues check out these FREE COURSES to Learn Excel, Excel Skills, and Excel Tips and Tricks.

This Excel tutorial explains how to use the Excel AND function with syntax and examples.

Description

The Microsoft Excel AND function returns TRUE if all conditions are TRUE. It returns FALSE if any of the conditions are FALSE.

The AND function is a built-in function in Excel that is categorized as a Logical Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the AND function can be entered as part of a formula in a cell of a worksheet.

Please read our AND function (VBA) page if you are looking for the VBA version of the AND function as it has a very different syntax.

Syntax

The syntax for the AND function in Microsoft Excel is:

AND( condition1, [condition2], ... )

Parameters or Arguments

condition1
The first condition to test whether it is TRUE or FALSE.
condition2, …
Optional. Additional conditions to test whether they are TRUE or FALSE. There can be up to 30 conditions in total.

Returns

The AND function returns TRUE if all conditions are TRUE.
The AND function returns FALSE if any of the conditions are FALSE.

Example (as Worksheet Function)

Let’s look at some Excel AND function examples and explore how to use the AND function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the Excel spreadsheet above, the following AND examples would return:

=AND(A1>10, A1<40)
Result: TRUE

=AND(A1=30, A2="www.checkyourmath.com")
Result: FALSE

=AND(A1>=5, A1<=30, A2="www.techonthenet.com")
Result: TRUE

Frequently Asked Questions

Question: I need to translate some Quattro Pro functions to Excel. The #AND# function in Qpro can be placed in the middle of a nest and return a number. For example, @if(…….A1>B1#and#A1<B3,7,0)

What this says is, after some other function, if A1 is greater than B1 and A1 is less than B3, return 7 otherwise 0. How do I get Excel to do this?

Answer: This can be done in Excel by combining the AND function with the IF function like this:

=IF(AND(A1>B1,A1<B3)=TRUE,7,0)

Question: In Microsoft Excel, I’m trying to use the If function to return 25 if cell A1 > 100 and cell B1 < 200. Otherwise, it should return 0.

Answer: You can use the AND function to perform an AND condition in the If function as follows:

=IF(AND(A1>100,B1<200),25,0)

In this example, the formula will return 25 if cell A1 is greater than 100 and cell B1 is less than 200. Otherwise, it will return 0.


Question: In Microsoft Excel, I want to write a formula for the following logic:

If R1 AND R2<0.3 AND R3<0.42 THEN «OK» OTHERWISE «NOT OK»

Answer: You can write an IF statement that uses the AND function as follows:

=IF(AND(R1<0.3,R2<0.3,R3<0.42),"OK","NOT OK")

Question: I have been looking at your Excel IF, AND and OR sections and found this very helpful, however I cannot find the right way to write a formula to express if C2 is either 1,2,3,4,5,6,7,8,9 and F2 is F and F3 is either D,F,B,L,R,C then give a value of 1 if not then 0. I have tried many formulas but just can’t get it right, can you help please?

Answer: You can write an IF statement that uses the AND function and the OR function as follows:

=IF(AND(C2>=1,C2<=9, F2="F",OR(F3="D",F3="F",F3="B",F3="L",F3="R",F3="C")),1,0)

Question:In Excel, I am trying to create a formula that will show the following:

If column B = Ross and column C = 8 then in cell AB of that row I want it to show 2013, If column B = Block and column C = 9 then in cell AB of that row I want it to show 2012.

Answer:You can create your Excel formula using nested IF functions with the AND function.

=IF(AND(B1="Ross",C1=8),2013,IF(AND(B1="Block",C1=9),2012,""))

This formula will return 2013 as a numeric value if B1 is «Ross» and C1 is 8, or 2012 as a numeric value if B1 is «Block» and C1 is 9. Otherwise, it will return blank, as denoted by «».

What is the IF AND Function in Excel?

IF AND function in Excel is a powerful combination of logical functions in Excel that allows users to evaluate multiple conditions in a single formula. It simplifies calculations by returning “TRUE” or “FALSE” results based on whether all specified conditions are met, making data analysis more efficient and accurate.

For example, =IF(AND(A6=”Banana”,B6<=25),”Reorder”,”Don’t Order”) can help decide whether to reorder bananas.

If both conditions are true, the function will return “Reorder” to indicate the need for more bananas; otherwise, it will return “Don’t Order” to signify no need for reordering.

IF AND function in Excel

We can automate processes, reduce errors, and make informed decisions based on data by using IF AND statements. They are particularly useful in determining whether an employee qualifies for a promotion or incentive, verifying a customer’s eligibility for a discount, or checking the delivery status of customer orders.

Key Highlights

  • The IF function’s output depends on whether the AND function returns TRUE or FALSE.
  • We can nest the IF AND function within other Excel functions for complex tests.
  • Other logical functions like OR or NOT can replace the AND function based on specific conditions.

Syntax of IF AND Function in Excel

IF(AND(Logical1, Logical2,…), val_if_true, val_if_false)

Explanation:

  • Logical1, Logical2: Test/ compare values of specified cells
  • Value_if_true: Value Excel returns if the condition is satisfied
  • Value_if_false: Value Excel returns if the condition is not satisfied

How to Use the IF AND Function in Excel?

You can download this IF AND Function Excel Template here – IF AND Function Excel Template

#1 Testing Two Conditions

A] Consider the table below consisting of Employee Names, Departments, and the days they were present in six months. Employees are eligible for the promotion if they belong to the Sales department and are present for at least 160 days. We will use the IF AND function in Excel to check the two conditions.

Testing Two Conditions

To use the function, follow these steps:

Step 1: Create a new column heading called “Eligible for Promotion.”

Step 2: Select the cell where you want to display the result (let’s assume it is cell D6), and type the formula =IF(AND(B6=”Sales”,C6>=160),”Yes”,”No”).

Testing Two Conditions 2

Here’s how the formula works:

1. The AND function checks two conditions:

  • Condition 1 (B6=”Sales”): If an employee belongs to the Sales department.
  • Condition 2 (C6>=160): If the employee was present for at least 160 days.

2. If the values meet both conditions, the AND function returns TRUE and passes this information to the IF function.

3. The IF function then returns the value “Yes” if the condition is TRUE and “No” if it’s FALSE.

Step 2: Press Enter key to see the result

Testing Two Conditions result

Result- Employee Mike belongs to the Sales department but was present for less than 160 days. As he satisfies only one condition, he is not eligible for the promotion.

Step 3: To check the eligibility of remaining employees, drag the formula into the other cells

result

B] Below is a table that shows a list of orders along with their respective products, Progress, and Delivery status. We aim to determine whether the final order status has been closed or is still open.

example 2

Follow these steps to understand how to check the final order status:

Step 1: Create a new column called “Status.”

Step 2: In an empty cell, such as E6, enter the formula =IF(AND(C6=”Delivered”,D6=”On-time”),”Closed”,”Open”).

formula

Explanation of the formula:

1. The AND function verifies two conditions:

    • Condition 1 (C6=”Delivered”): It checks if an order’s Progress is marked as “Delivered.”
    • Condition 2 (D6=”On-time”): It verifies if the order was delivered “On-time.”

2. When both conditions satisfy, the AND function returns a TRUE value, which is passed to the IF function.

3. The IF function then returns “Closed” if the condition is TRUE and “Open” if it’s FALSE.

Step 3: Press Enter key to get the result

example 2 result

Result- The Progress status for Order No. 51 is Delivered, and it was delivered on time, i.e., it satisfies both conditions. Therefore, the IF AND formula returns “Closed” for that order.

Step 4: Drag the formula into the remaining cells to check the remaining orders’ current status.

all rows result

#2 Nested IF AND Statement

A Nested IF AND Statement in Excel is like a set of nested (embedded) boxes where each box has an IF AND condition to test. Here’s an example of a nested IF AND statement.

We have a list of students with their marks in Chemistry and Maths, and we want to evaluate their performance based on their marks in the two subjects.

Nested IF AND Statement

Here’s how we can use the IF AND Function in Excel to check the student’s performance-

Step 1: Create a new column heading “Performance”.

Step 2: In an empty cell (e.g., D6), enter the formula:

=IF(AND(B6<30,C6<25),”Poor”,IF(AND(B6>60,C6>30),”Excellent”,”Average”))

Nested IF AND Statement formula

Note: It is known as a Nested IF AND statement because one IF AND formula appears inside the other. In other words, two IF AND statements are in a single formula.

Explanation of the Formula:

1. The first AND formula check two conditions:

  • Condition 1 (B6<30): If marks scored in Chemistry are less than 30
  • Condition 2 (C6<25): If marks scored in Maths are less than 25.

If both conditions satisfy, the AND function returns TRUE and passes the information to the first IF function, which displays the result as Poor.

2. The second AND formula check two conditions:

  • Condition 1 (B6>60): If marks scored in Chemistry is more than 60.
  • Condition 2 (C6>30)): If marks scored in Maths is more than 30.

If both conditions are satisfied, the AND function returns TRUE and passes the information to the second IF function, which displays the result as Excellent. If not, the formula shows the result as Average.

Step 3: Press Enter key to get the output

Nested IF AND Statement output

Result- Johana has scored more than 60 marks in Chemistry and more than 30 marks in Maths, satisfying both conditions. As a result, the Nested IF AND formula display the output as Excellent

Step 4: Drag the Nested IF AND formula into the remaining cells to get the performance of the remaining students.

Nested IF AND Statement result

#3 Alternatives to the IF AND Function

There are two logical functions to use instead of AND, depending on the specific situation: OR and NOT.

1. OR Function
It is to test whether at least one of several conditions is true.

For instance, the formula =IF(OR(A2=”Apple”, A2=”Orange”), “Fruit”, “Not Fruit”) will display “Fruit” if cell A2 contains either “Apple” or “Orange,” and “Not Fruit” if it has any other value.

OR Function

2. NOT Function
It returns the opposite of the result of another logical function.

For example, the formula =IF(NOT(A2=”Banana”), “Not Banana”, “Banana”) will return “Not Banana” if cell A2 does not contain “Banana” and “Banana” otherwise.

NOT Function

It is crucial to choose the most appropriate function based on the conditions being tested. Additionally, these functions can be nested to create more complex formulas.

Things To Remember

  • If any argument is an empty cell, the IF AND function ignore it. However, if all arguments are empty cells, Excel returns a #VALUE! Error.

#VALUE! Error

  • In newer versions of Excel, including Excel 2007 and later versions, you can include up to 255 arguments in the formula of the IF AND function. For previous versions of Excel, Microsoft had limited the AND function to test a maximum of 30 conditions at a time.
  • You can use a combination of text and numeric values, cell references, boolean values, and comparison operators as arguments in the IF AND function. But it can’t handle strings. If the arguments are characters, then AND returns a #VALUE! error.

#VALUE! Error result

Best Practices

  • Use descriptive cell and range names instead of cell references to simplify formulas. For instance, consider the formula: =IF(AND(MathGrade>=70,ScienceGrade>=60),”Pass”,”Fail”)

In this formula, “MathGrade” and “ScienceGrade” are named ranges that refer to the appropriate columns in the table.

  • Avoid common mistakes when using the IF AND function, such as forgetting to close all parentheses or improperly nesting the functions.
  • Thoroughly test the formula by inputting different values and conditions to ensure it returns expected outcomes in all scenarios before using it in more extensive spreadsheets or analyses.

Frequently Asked Questions (FAQs)

Q1. How do you use IF and AND in Excel together?

Answer: To use the IF and AND functions together in Excel, you can create a formula like this:

=IF(AND(B6=31,C6=”Achieved”),”Eligible”,”Not Eligible”)

In this example, we are checking whether an employee is eligible for an incentive based on two criteria: attendance and achieving a monthly target.

  • The AND function checks whether the employee was present for 31 days a month (using cell B6) and whether they achieved their monthly target (using cell C6).
  • If the cell values meet both criteria, the AND function returns TRUE, and the IF function displays “Eligible” as a result.
  • If the cell values meet either criterion, the AND function returns FALSE, and the IF function displays “Not Eligible” as a result.

use IF and AND in Excel together

Q2. Can you have 2 IF AND statements in Excel?

Answer: Yes, you can use two IF AND statements in a single formula in excel to check multiple criteria. For instance, consider the formula

=IF(AND(B6>=25000,C6=”Digital Wallet”),”20% “,IF(AND(B6>=20000,C6=”Credit Card”),”10%”,”No Discount”))

2 IF AND statements in Excel

In this formula:

  • The first IF AND statement check whether a customer has a purchase total greater than or equal to $25,000 and whether the customer chooses to pay through a digital wallet.

If both conditions are met, the formula returns a 20% discount on the total bill.

  • The second IF AND statement check whether a customer has a purchase total greater than or equal to $20,000 and whether the customer chooses to pay through a credit card.

If both conditions are met, the formula returns a 10% discount on the total bill. If neither of these conditions is met, the formula returns “No Discount“.

Q3. Can you use IF AND and OR together in Excel?

Answer: Yes, you can use IF AND and OR functions together in Excel to evaluate multiple criteria in a single formula. For example, consider the formula:

=IF(AND(A6=”Chair”,OR(B6=”Green”,B6=”Red”)),0.5*C6,0.9*C6)

In this formula, the AND function checks if the product is a chair and if its color is either green or red. If the AND function is TRUE, the IF formula reduces the product price by 50%, and if it is FALSE, it reduces the price by 10%.

IF AND and OR together in Excel

Recommended Article

The above article is a guide to using the IF AND Function in Excel, along with examples and downloadable templates. For more comprehensive articles, EDUCBA recommends the following articles-

  1. Excel Basic Functions
  2. HLOOKUP in Excel
  3. Excel Count Function
  4. Excel INDEX Function

The AND Function in excel is a logical function that tests multiple conditions and returns “true” or “false” depending on whether they are met or not. The formula of AND function is “=AND(logical1,[logical2]…),” where “logical1” is the first condition to evaluate.

AND Function in Excel

Table of contents
  • AND Function in Excel
    • Syntax of the AND Function
    • The Characteristics of AND Function
    • The Output of AND Function
    • How to Use AND Function in Excel?
      • Example #1–AND Function
      • Example #2–AND Function With Nested IF Function
      • Example #3–AND Function With Nested IF Function
    • Nesting of AND Function in Excel
      • Example #4–Nested AND Function
    • Limitations of AND Function
    • Frequently Asked Questions
    • Recommended Articles

Syntax of the AND Function

The syntax is stated as follows:

AND Function Formula

The function accepts the following arguments:

  • Logical 1: This is the first condition or logical value to evaluate.
  • Logical 2: This is the second condition or logical value to evaluate.

The “logical 1” is a mandatory argument and “logical 2” is an optional argument.

The Characteristics of AND Function

  • It returns “true” if all conditions or logical values evaluate to true.
  • It returns “false” if any of the conditions or logical values evaluates to false.
  • It can have more logical values depending on the situation and the requirement.
  • It treats the value zero as “false” and all non-zero values as “true” while evaluating numbers.
  • It ignores empty cells provided as an argument.
  • It is often used in combination with other Excel functionsExcel functions help the users to save time and maintain extensive worksheets. There are 100+ excel functions categorized as financial, logical, text, date and time, Lookup & Reference, Math, Statistical and Information functions.read more like IF, OR, and so on.

The Output of AND Function

The output in different situations is given as follows:

AND Function formula explanation

The output while evaluating numbers is given as follows:

AND Function formula explanation 1

How to Use AND Function in Excel?

It is easy to use the AND function. Let us understand its working with the help of a few examples.

You can download this AND Function Excel Template here – AND Function Excel Template

Example #1–AND Function

There are three levels and ten players in a game. To be a winner, a player has to clear all three levels. The player loses if he/she fails in any of the three levels.

The performance of the players in different levels is given in the following table. We are required to determine the winner.

AND Function Example 1

We apply AND formula in column E.

AND Function Example 1-1

The output of the formula appears in column E.

AND Function Example 1-2

Player 2 and player 10 have cleared all the levels. Since all the logical conditions for these two players are met, the AND function gives the output “true.”

The rest of the players were unable to clear all three levels. If any of the levels is not cleared, the AND function returns “false.”

AND Function Example 1-3

Example #2–AND Function With Nested IF Function

Let us consider the following example.

We have the marks (in percentage) of ten students in a school. We have to determine the grade obtained by each student according to the criteria given.

AND Function Example 2-1

A student obtains “A+” if he/she scores more than 90%. If the percentage is greater than or equal to 80% but less than or equal to 90%, grade “A” is given.

If the percentage is less than 40%, the student fails. Likewise, the grades for the different percentages are given in the following table.

AND Function Example 2

We apply the following formula.

“=IF(B2>90,”A+”,IF(AND(B2<=90,B2>80),”A”,IF(AND(B2<=80,B2>75),”B+”,IF(AND(B2<=75,B2>70),”B”,IF(AND(B2<=70,B2>60),”C+”,IF(AND(B2<=60,B2>50),”C”,IF(AND(B2<=50,B2>40),”D”,”FAIL”)))))))”

We use the nested IF functionIn Excel, nested if function means using another logical or conditional function with the if function to test multiple conditions. For example, if there are two conditions to be tested, we can use the logical functions AND or OR depending on the situation, or we can use the other conditional functions to test even more ifs inside a single if.read more with multiple AND functions to compute the grades. The latter allows testing two conditions together.

The syntax of the IF function is stated as follows:

“=IF(logical_test,[value_if_true],[value_if_false])”

The IF function returns “true” if the condition is met, else returns “false.”

The first logical test is “B2>90.” If this condition is “true,” grade “A+” is assigned. If this condition is “false,” the IF function evaluates the next condition.

The next logical testA logical test in Excel results in an analytical output, either true or false. The equals to operator, “=,” is the most commonly used logical test.read more is “B2<=90, B2>80.” If this condition is “true,” grade “A” is assigned. If this condition is “false,” the next statement is evaluated. Likewise, the IF function tests every condition given in the formula.

The last logical test is “B2<=50, B2>40.” If this condition is “true,” grade “D” is assigned, else the student fails.

We apply the formula to all categories of students, as shown in the following image.

AND Function Example 2-3

The output of the formula is shown in the succeeding image.

AND Function Example 2-2

Example #3–AND Function With Nested IF Function

The name of employees and the sales revenueSales revenue refers to the income generated by any business entity by selling its goods or providing its services during the normal course of its operations. It is reported annually, quarterly or monthly as the case may be in the business entity’s income statement/profit & loss account.read more generated by them for an organization are shown in the succeeding image. Every employee is given a monetary incentive depending on the total sales made by him/her.

We have to calculate the incentives of all the employees based on their performance.

AND Function Example 3-1

The incentive criteria followed by the organization is given in the succeeding table.

AND Function Example 3

We apply the following formula.

“=IF(AND(B2>=3000),400,IF(AND(B2>=2000,B2<3000),200,IF(AND(B2>=1500,B2<2000),150,IF(AND(B2>=1000,B2<1500),100,0))))”

We use multiple IFs In Excel, multiple IF conditions are IF statements that are contained within another IF statement. They are used to test multiple conditions at the same time and return distinct values. Additional IF statements can be included in the ‘value if true’ and ‘value if false’ arguments of a standard IF formula.read moreand multiple AND functions to calculate the incentives received by all the employees, as shown in the following table.

AND Function Example 3-2

Roman generates sales revenue of $3000. So, he receives an incentive amount of $400.

The revenue generated by David and Tom is $500 and $600, respectively. To be eligible for an incentive, minimum sales of $1000 is required. Hence, they do not get any incentive.

AND Function Example 3-3

Nesting of AND Function in Excel

A nested function refers to using a function inside another Excel function. In Excel, the nesting of functions up to 64 levels is allowed.

Example #4–Nested AND Function

We have a list of candidates who wish to join the Army subject to certain conditions. The eligibility criteria are stated as follows:

  • The age should be greater than or equal to 18, but less than 35 years.
  • The height should be greater than 167 cm.
  • The eyesight should be normal.
  • The candidate must have completed the long-run task.

We need to find out the candidates who are eligible for joining the Army.

AND Function Example 4

To evaluate the candidates on the given parameters, we use the nested AND function.

We apply the following formula.

“=AND(B2=”Normal”,C2>167,D2=”Successful”,AND(E2>=18,E2<35))”

We evaluate multiple logical conditions simultaneously. We also check whether the age is within the prescribed limit or not. So, we use the AND function inside another AND function.

AND Function Example 4-1

The output of the formula is shown in the succeeding image.

AND Function Example 4-2

The candidates Ralph, Alex, and Scott pass the selection criteria. Hence, their eligibility output (in column F) is “true.” The remaining candidates are not eligible for joining the Army.

AND Function Example 4-3

Limitations of AND Function

The limitations are listed as follows:

  • With Excel 2007 onwards, the AND function can test up to 255 arguments given that the length of the formula does not exceed 8,162 characters.
  • In Excel 2003 and previous versions, the AND function can test up to 30 arguments given that the length of the formula does not exceed 1,024 characters.
  • The AND function returns “#VALUE! error#VALUE! Error in Excel represents that the reference cell the user has either entered an incorrect formula or used a wrong data type (mostly numerical data). Sometimes, it is difficult to identify the kind of mistake behind this error.read more” if logical conditions are passed as text or if none of the arguments evaluates to a logical value.
  • The AND function returns “#VALUE! error” if all the arguments provided are empty cells.

The following two images show the output of the AND function when an empty cell and a text string is provided as an argument.

AND Function Example 5

Frequently Asked Questions

#1 – When should the AND function of Excel be used

#2 – How is the AND function used with the OR function in Excel?

The OR function helps compare two values or statements. The AND function is combined with the OR function by the following formulas:

“=AND(OR(Condition1,Condition2),Condition3)”
“=AND(OR(Condition1,Condition2),OR(Condition3,Condition4)”
“=OR(AND(Condition1,Condition2),Condition3)”
“=OR(AND(Condition1,Condition2),AND(Condition3,Condition4))”

#3 – What is the difference between AND, IF, and OR functions in Excel?

The difference between the three functions is stated as follows:

– The AND function helps evaluate multiple conditions at the same time. It returns “true” when all conditions are true; otherwise, it returns “false.”
– The IF function helps compare the value with the result expected by the user. It returns specific values for the “true” and “false” outcomes.
– The OR function helps compare two values or two statements. It returns “true” when at least one of the specified conditions is met. It returns “false” if all the logical values evaluate to false.

  • The AND function tests multiple conditions and returns “true” or “false” depending upon whether they are met or not.
  • The AND function returns “true” if all conditions evaluate to true and returns “false” if any of the conditions evaluates to false.
  • The AND function treats the value zero as “false.”
  • The AND function can test up to 255 arguments in the latest versions of Excel.
  • The AND function returns “#VALUE! error” if logical conditions are passed as a text.
  • The formula of the IF function is “=IF(logical_test,[value_if_true],[value_if_false]).”

Recommended Articles

This has been a guide to AND Function in Excel. Here we discuss how to use AND Formula in Excel along with examples and downloadable excel templates. You may also look at these useful functions in Excel –

  • Excel Pivot Table Add ColumnThe pivot table add column helps to add a new column in a pivot table.read more
  • Excel Convert FunctionAs the word itself, the Excel CONVERT function defines that it can convert the numbers from one measurement system to another measurement system.read more
  • VBA Boolean Data TypeBoolean is an inbuilt data type in VBA used for logical references or logical variables. The value this data type holds is either TRUE or FALSE and is used for logical comparison. The declaration of this data type is similar to all the other data types.read more
  • IF AND Formula in ExcelThe IF AND excel formula is the combination of two different logical functions often nested together that enables the user to evaluate multiple conditions using AND functions. Based on the output of the AND function, the IF function returns either the “true” or “false” value, respectively.
    read more

Понравилась статья? Поделить с друзьями:
  • Can you unhide all sheets in excel
  • Can you translate the word перевод
  • Can you translate in microsoft word
  • Can you translate in excel
  • Can you translate a document in word