The AND function returns TRUE if all given conditions are met, and FALSE if at least one condition is not satisfied.
This function is useful for creating complex Boolean expressions in formulas.
Syntax
AND(logical_test1, [logical_test2, ...])
Argument |
Description |
Permitted values |
|---|---|---|
logical_test1 |
A Boolean condition or expression, or a reference to a cell containing an expression that evaluates to TRUE or FALSE, or an expression that can be converted to a Boolean value. |
Any Boolean expressions or conditions that return TRUE or FALSE |
[logical_test2, ...] |
(optional) Additional Boolean conditions or expressions, or references to cells containing expressions with Boolean values TRUE or FALSE, or expressions that can be reduced to Boolean values |
Any Boolean expressions or conditions that return TRUE or FALSE |
Examples of use
Checking multiple conditions
=AND(A1 > 10, B1 < 5)
This formula will return TRUE if the value in A1 is greater than 10 and the value in B1 is less than 5.
Use in a conditional formula
=IF(AND(A1 > 0, A1 < 100), "Within range", "Out of range")
This formula will check whether the value in cell A1 is in the range from 0 to 100 and return the corresponding message.
Checking whether a number is even and positive
=AND(ISEVEN(A1), A1 > 0)
This formula will return TRUE if the value in A1 is even and positive.
Notes
–The AND function can accept up to 255 logical conditions.
–The function is often used in combination with other functions, such as IF, to create more complex logical expressions.