Comparisons & boolean operators
Comparisons and boolean operators turn values into conditions. Use them to test values, combine conditions, and drive branching logic, most commonly inside IF(...).
They return 1 for true and 0 for false.
Start here if…
- You want to write a condition such as
'Revenue' > 1000 - You want to combine conditions with
AND,OR,NOT,XOR - You need a
TRUE/FALSEhelper function - You’re writing the condition part of
IF(condition, value_if_true, value_if_false)
Not here if…
- You are searching the catalog for a function page by name such as
GT,EQ,AND, orIS_NA→ see Logical functions - You want branching behavior and examples for
IF(...)specifically → see IF
Mental model
- Comparisons compare matching rows and return 1 (true) or 0 (false)
- Boolean operators combine or invert conditions and also return 1 or 0
TRUE('Node')/FALSE('Node')returns 1/0 wherever'Node'is definedIS_NA('Node')returns 1 where'Node'is undefined (and can expand result size)- In
IF(...), 0 is interpreted as false and any other value as true
Comparison operators
| Operator | Function equivalent | Details | Returns 1 when… |
|---|---|---|---|
= | EQ('Node1', 'Node2') | EQ (=) | values are equal |
!= | NEQ('Node1', 'Node2') | NEQ (!=) | values are not equal |
> | GT('Node1', 'Node2') | GT (>) | left is greater than right |
>= | GTE('Node1', 'Node2') | GTE (>=) | left is greater than or equal to right |
< | LT('Node1', 'Node2') | LT (<) | left is less than right |
<= | LTE('Node1', 'Node2') | LTE (<=) | left is less than or equal to right |
Many comparisons can be written either as a function call or as an operator expression, for example GT('Node1', 'Node2') or 'Node1' > 'Node2'.
Boolean operators
| Operator | Function equivalent | Details | Returns 1 when… |
|---|---|---|---|
AND / && | AND('Node1', 'Node2') | AND (&&) | both inputs are true |
OR / ` | ` | OR('Node1', 'Node2') | |
NOT | NOT('Node') | NOT | input is false (0) |
XOR | XOR('Node1', 'Node2') | XOR | exactly one input is true |
These operators are most commonly used inside IF(...) conditions.
Defined/undefined helper functions
| Function | Details | Returns |
|---|---|---|
TRUE('Node') | TRUE | 1 on defined intersections |
FALSE('Node') | FALSE | 0 on defined intersections |
IS_NA('Node') | IS_NA | 1 on undefined intersections |
Common patterns
- Flag positive values:
'Value' > 0 - Combine conditions:
('Margin' < 0) OR ('Revenue' = 0) - Branching logic:
IF('Net Income' > 0, 'Net Income' * 'PayoutRate', 0) - Truthiness shortcut:
IF('Delta', 1, 0)treats any non-zero value as true - Check whether a node is defined:
IF(TRUE(‘Sales’), 'Node1', 'Node2') - Find missing intersections:
IS_NA('Sales')
Pitfalls & troubleshooting
- Truthiness surprises: in conditions,
0is false and any non-zero value is true - Defined vs undefined:
TRUE('Node')andFALSE('Node')apply where the node is defined; useIS_NA('Node')to detect undefined intersections - Cube size risk:
IS_NA(...)can expand result size significantly - Dimensional mismatch: some logical functions, such as
XOR, may behave unexpectedly when inputs differ in granularity
Related sections
- IF: how conditions are interpreted in
IF(...) - Formula basics: parentheses, evaluation order, and quoting rules
- Troubleshooting guide: wrong shape, wrong numbers, empty output, and missing values