Logical functions use TRUE and FALSE values.
Logical Values
FALSE (): Returns the logical value FALSE.
TRUE (): Returns the logical value TRUE.
AND and OR Functions
AND (logical_list): Returns TRUE if all arguments in list are true; returns FALSE if at least one argument in the list is false. The arguments can be a logical value (e.g., TRUE) or expression (e.g., 1+2=3).
OR (logical_list): Returns TRUE if at least one of a series of logical arguments is true. The arguments can be a logical value or expression.
Examples:
|
A |
B |
C |
D |
1 |
TRUE |
TRUE |
FALSE |
0 |
2 |
TRUE |
FALSE |
TRUE |
2 |
Formula |
Result |
=AND(A1:A2) |
TRUE |
=AND(A1:C1) |
FALSE |
=AND(A1:D1) |
#VALUE! (cell D1 does not contain a logical value or expression) |
=AND(1>2, 1>0) |
FALSE |
=AND(D1=0, D2=0) |
FALSE |
=OR(A1:A2) |
TRUE |
=OR(A1:C1) |
TRUE |
=OR(B2, C1) |
FALSE |
=OR(D1=0, D2=0) |
TRUE |
NOT Function
NOT (logical): Returns a logical value that is the opposite of the specified logical value or expression.
Examples:
Formula |
Result |
=NOT(TRUE) |
FALSE |
=NOT(FALSE) |
TRUE |
=NOT(10>5) |
FALSE |
=NOT(3*3=10) |
TRUE |
IF Function
IF (test, true_value, false_value): Returns true_value if test is TRUE (or nonzero), or false_value if test is FALSE (or zero). If test is FALSE (or zero), but the false_value is omitted, then FALSE will be returned. Note that test can be a numerical value, or a logical expression (e.g., C5=3). Note also that true_value and false_value can be numerical values (e.g., 10), text strings (e.g., "Yes"), logical values (e.g., TRUE), cell references (e.g., A1), or formulas (e.g., SUM(A1:C5) ).
Examples:
|
A |
1 |
76 |
2 |
43 |
3 |
87 |
4 |
|
Formula |
Result |
=IF(A1>=50, "Pass", "Fail") |
Pass |
=IF(A2>=50, "Pass", "Fail") |
Fail |
=IF(A2>=50, "Pass") |
FALSE |
=IF(TRUE, "Yes", "No") |
Yes |
=IF(A1, DOLLAR(A1)) |
$ 76.00 |
=IF(A4, DOLLAR(A4)) |
FALSE |