How to Use the AND Function in Excel – 7 Examples

This is an overview.

and function in excel overview

 


Introduction to the AND Function

and function syntax

  • Function Objective:

Checks all arguments and returns TRUE if all arguments are TRUE.

  • Syntax:

=AND(logical1, [logical2])

  • Arguments Explanation:
Argument Compulsory/Optional Explanation
logical1 Compulsory 1st logical condition.
[logical2] Optional 2nd logical condition.
  • Return Parameter:

Returns a logical value- TRUE or FALSE.

Example 1 – Using the AND Function to Test with Logical Values

The sample dataset showcases donor names, donation amounts, mediums of donations and donation dates. The AND function will be used in Column G , to find  rows containing more than $500 before August, 2021.

and function for logical test in excel

Steps:

  •  In G5, enter the formula:
=AND(D5>$J$11,F5<$J$12)
  • Press Enter. The function will return TRUE: Adam donated more than $500 before 1 August, 2021.
  • Drag down the Fill Handle to see the result in the rest of the cells.

and function for logical test in excel

The AND function returns FALSE if a condition isn’t met.


Example 2 – Using the AND Function with Conditional Formatting

To highlight names for donations greater than $500 before 1 August, 2021, use Conditional Formatting:

Step 1:

  • Select all names in Column C.
  • In the Home tab, choose New Rule in Conditional Formatting.

and function with conditional formatting in excel

Step 2:

  • Select “Use a formula to determine which cells to format” as Rule Type,
  • Enter:

=AND(D5>$I$11,F5<$I$12)

  • Click Format.

and function with conditional formatting in excel

Step 3:

  • In Fill, select a color.
  • Click OK to see a preview.

and function with conditional formatting in excel

Step 4:

  • Click OK.

and function with conditional formatting in excel

This is the output.

and function with conditional formatting in excel

Read More: How to Use Conditional Formatting with AND Function in Excel


Example 3 – Combining the OR with the AND Function

The OR Function returns TRUE if any of the conditions are met and FALSE if all conditions aren’t met.

To find names for cash or check donations before 1 August, 2021 in Column G:

Steps:

  • In G5, enter:
=OR(AND(E5=$J$11,F5<$J$13),AND(E5=$J$12,F5<$J$13))
  • Press Enter
  • Drag down the Fill Handle to see the result in the rest of the cells..

and function with or function in excel


Example 4 – Combining the IF with the AND Function

Use the IF function before the AND function.

To see the names who donated more than $500 before 1 August, 2021 in Column G .

Steps:

  • In G5, enter the formula:
=IF(AND(D5>$J$11,F5<$J$12),C5,"")
  • Press Enter.
  • Drag down the Fill Handle to see the result in the rest of the cells.

and function with if in excel

Read More: How to Use IFS and AND Functions Together in Excel


Example 5 – Enclosing the MIN & MAX Functions with AND

Use the MIN and MAX functions inside the AND function to determine if a value falls between two other values.

Steps:

  • In E5, enter the formula:
=AND(D5>MIN(B5:C5),D5<MAX(B5:C5))
  • Press Enter.

If the output is found between the two values, the function returns TRUE. Otherwise FALSE.

and function with max min in excel


Example 6 – Applying a Nested AND Function in Excel

To check multiple conditions, use the nested AND function.

Find online donated amounts greater than $300, between 7/15/2021 and 8/1/2021.

  • Use the following formula.
=AND(D5>$J$10,E5=$J$11,AND(F5<$J$12,F5>$J$13))

Nested AND Function


Example 7 – Using the AND Function with a Nested IF Function

Use the AND function with the nested IF function.

Categorize the donors based on the donated amount.

  • Use the following formula.
=IF(AND(D5>=900),"Major Donor",IF(AND(D5>=500,D5<900),"Regular Donor",IF(AND(D5>0,D5<500),"Small Donor",0)))

Using AND function with nested IF function in Excel

Read More: Nested IF and AND Functions in Excel 


Things to Keep in Mind

The AND function is able to include up to 255 logical conditions.


Frequently Asked Questions

  •  What happens if I use an empty cell as an argument in the AND function?

The empty cell is considered a logical value of FALSE. You can use the IF function with the ISBLANK function to avoid this issue.


Download Practice Workbook

Download the Excel Workbook.


Excel AND Function: Knowledge Hub


<< Go Back to Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nehad Ulfat
Nehad Ulfat

NEHAD ULFAT is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET but switched gears, working as a content developer.  In this role, he creates techy content all about Excel... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo