ID EN
#Logical

AND

Excel Functions

Test multiple conditions at the same time

Syntax

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

Arguments

Parameter Description
logical1 The first condition or logical value to evaluate.
logical2 [optional] The second condition or logical value to evaluate.

Return Value

TRUE if all conditions are met, otherwise FALSE

Details

The AND function is one of Excel's logical functions. It is designed to test multiple conditions simultaneously and return TRUE only if all the conditions are met. If any condition is not met AND will return FALSE. You can use the AND function to check if a series of values all meet certain criteria before performing a calculation or action. The AND function is often combined with other functions like IF, NOT, and OR to construct more complex logical tests. It commonly appears in the logical test of the IF function and in the rules used for conditional formatting and data validation. The AND function is a good way to avoid complicated formulas that involve many nested IFs. The purpose of the AND function is to evaluate multiple conditions and only return TRUE if all conditions are TRUE. Ex

Examples

AND function basics

The purpose of the AND function is to evaluate multiple conditions and only return TRUE if all conditions are TRUE. Excel's AND function can handle up

EXCEL
=AND(TRUE,TRUE,TRUE) // returns TRUE
AND function basics

If any argument is FALSE, AND will immediately return FALSE:

EXCEL
=AND(TRUE,TRUE,FALSE) // returns FALSE
AND function basics

Typically, logical arguments are provided to AND as logical expressions, for example:

EXCEL
=AND(A1>0,A1<5)
=AND(A1>0,B1>0)
=AND(A1="red",B1="small")
AND function basics

All expressions in the formulas above will be evaluated as TRUE or FALSE. Notice that text values used in comparisons must be enclosed in double quote

EXCEL
=AND(1,2,3) // returns TRUE
=AND(1,2,0) // returns FALSE
Example - number is between

You can use AND to check if a number in a cell is between two numbers. For example, to test if a number is between 10 and 20 we can use AND as seen in

EXCEL
=AND(B5>10,B5<20)
Example - number is between

To include the numbers 10 and 20 in the allowed range of values, we can adjust the logic to use greater than or equal to (>=) or less than or equal to

EXCEL
=AND(B5>=10,B5<=20)

See Also

IF OR XOR NOT