Logical Functions
AND
Returns True only if both a and b are true. Otherwise returns False.
Syntax | Where | Result |
---|---|---|
AND(a, b) | a is logical b is logical | A logical value, true or false |
Example | Result |
---|---|
=AND(4 > 3, 5 < 7) | True |
=AND(4 > 3, 5 < 4) | False |
OR
Returns True is either a or b (or both) is true. Otherwise returns False.
Syntax | Where | Result |
---|---|---|
OR(a, b) | a is logical b is logical | A logical value, true or false. |
Example | Result |
---|---|
=OR(4 > 3, 5 < 7) | True |
=OR(4 > 3, 5 < 4) | True |
=OR(3 > 4, 5 < 4) | False |
NOT
Returns True if a is false, or False if a is true.
Syntax | Where | Result |
---|---|---|
NOT(a) | a is logical | A logical value, true or false |
Example | Result |
---|---|
=NOT(4 > 3) | True |
=NOT(NOT(1 = 1) | True |
TRUE
Returns a logical true.
Syntax | Result |
---|---|
TRUE() | A logical value, always true |
Example | Result |
---|---|
=TRUE() | True |
FALSE
Returns a logical false.
Syntax | Result |
---|---|
FALSE() | A logical value, always false |
Example | Result |
---|---|
=FALSE() | False |
IF
Returns the value v if c is true, or w if c is false. Both v and w must be the same data type - e.g. both numbers or both text.
Syntax | Where | Result |
---|---|---|
IF(c, v, w) | c is logical v is anything w is anything | Either v or w |
Example | Result |
---|---|
="Hello" & IF(Gender = "Male", "sir", "madam") | Gender = Male "Hello sir" Gender = NOT Male "Hello madam" |