The AND function is a logical
function used to require more than one condition at the same time. AND returns
either TRUE or FALSE. To test if a number in A1 is greater than zero and less
than 10, use =AND(A1>0,A1<10). The AND function can be used as the
logical test inside the IF function to avoid extra nested IFs, and can be
combined with the OR function.
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.
Excel And Function Examples
The following spreadsheet shows
three examples of the Excel And function:
Formulas:
|
A
|
B
|
C
|
1
|
5
|
10
|
=AND(
A1>0, A1<B1 )
|
2
|
5
|
10
|
=AND(
A2>0, A2<B2, B2>12 )
|
3
|
5
|
10
|
=AND(
A3<0, A3>B3, B3>12 )
|
Results:
|
A
|
B
|
C
|
1
|
5
|
10
|
TRUE
|
2
|
5
|
10
|
FALSE
|
3
|
5
|
10
|
FALSE
|
Note that, in the above example spreadsheet:
- The function in cell C1 evaluates to TRUE, as BOTH of the supplied conditions are TRUE;
- The function in cell C2 evaluates to FALSE, as the third condition, B2>12, is FALSE;
- The function in cell C3 evaluates to FALSE, as ALL of the supplied conditions are FALSE.
No comments:
Post a Comment