The logical operators operate on Logical (Boolean) values.
&
ANDIf both sides of an AND operator are TRUE
, the Logical value TRUE
is returned; otherwise FALSE
is returned.
Note that if the left-hand side of an AND operator in an expression is FALSE
, the right-hand side is not evaluated.
!
unary NOTThe NOT operator returns the logical negation of the following expression.
|
ORIf either side of an OR operator is TRUE
, the Logical value TRUE
is returned; otherwise FALSE
is returned.
Note that if the left-hand side of an OR operator in an expression is TRUE
, the right-hand side is not evaluated.
In Fireworkz, Logical values and numeric values are freely convertible:
When numeric values are used in operations that require Logical values,
Fireworkz always maps the number zero to the Logical value FALSE
and any non-zero number to the Logical value TRUE
.
When Logical values are used in operations or calculations that require numeric values,
Fireworkz always maps the Logical value FALSE
to the number zero
and TRUE
to the number one.
Example:
Logical operators are often used to construct the condition required by the IF
function.
The following function adds the contents of cells A2
and B2
only if the contents of both cells A1
and B1
match the specified criteria:
IF(A1=6 & B1=4, SUM(A2, B2), 0)