Reference Updated April 9, 2026

IF

Category: Logical functions

Overview

The IF function evaluates a condition and returns one value when the condition is true and another when it is false. For every row of the input, the condition is evaluated independently.

Use this function to implement business rules such as thresholds, caps, floors, or other conditional logic.

Syntax

  • IF(Condition) returns the condition’s value where true and no value where false.
  • IF(Condition, ValueIfTrue) returns ValueIfTrue where true and no value where false.
  • IF(Condition, ValueIfTrue, ValueIfFalse) returns one value for true and another for false.

Example usage: IF('Margin' < 0, 0, 'Margin')

Parameters

ParameterDescriptionTypeRequired
ConditionA node evaluated to true or false. 0 is interpreted as false; all other values as true. Comparisons can be configured with logical functions.Node referenceYes
ValueIfTrueValue returned when the condition is true.Node reference or numberNo
ValueIfFalseValue returned when the condition is false.Node reference or numberNo

Building conditions

Conditions can be written as operators or with logical functions. Most users write the operator form directly in formulas.

OperatorFunctionMeaning
=EQ (=)equal
!=NEQ (!=)not equal
>GT (>)greater than
>=GTE (>=)greater than or equal
<LT (<)less than
<=LTE (<=)less than or equal
&&AND (&&)both conditions true
``
NOTinvert condition
IS_NAvalue is undefined

For details and pitfalls, see Comparisons & boolean operators.

Output Shape

AspectBehavior
DimensionalityUnion of all input dimensionalities. Per dimension, the finest granularity across the condition, ValueIfTrue, and ValueIfFalse is used.
Row countDepends on the form used. With all 3 arguments, the output contains one row per condition row (true rows get ValueIfTrue, false rows get ValueIfFalse). With 1 or 2 arguments, rows where the condition is false are dropped (become N/A).
ValuesThe condition is evaluated independently for each row

Watch Out

  • When all three arguments are provided, if ValueIfTrue or ValueIfFalse has finer dimensionality than the condition, both must have the same dimensionality. This check does not apply to the 1- or 2-argument form.
  • 0 is interpreted as false, any other value as true.
  • When IF returns N/A, the cell appears empty in tables and is excluded from charts. This is different from returning 0. N/A means “no value exists,” while 0 is a real numeric value.

Examples

Dividend payout

Dividends are only paid in years with positive net income. The payout equals 50 % of net income.

Input node: Dividend Payouts / Net Income

Value
50%

Input node: Net Income

YearValue
2025-30
202620
2027-10
20280
2029100

Formula: IF('Net Income' > 0, 'Net Income' * 'Dividend Payouts / Net Income', 0)

Year→ IF Result
20250
202610
20270
20280
202950

Dividends are only paid in years with positive net income.

Example calculations:

  • 2026 → 20 × 50 % = 10
  • 2029 → 100 × 50 % = 50

Floor at zero

Negative margins should be reported as 0.

Input node: Margin

YearValue
202515
2026-8
202722
2028-3

Formula: IF('Margin' < 0, 0, 'Margin')

Year→ IF Result
202515
20260
202722
20280

IF used as a condition check

When only the condition is provided, IF returns 1 when the condition is true and no value (N/A) when it is false.

Input node: Revenue

YearRevenue
2025800
20261200
20271500
2028600

Formula: IF('Revenue' > 1000)

Year→ IF Result
20261
20271

In this example, the comparison 'Revenue' > 1000 evaluates to 1, which is what IF returns. If you use IF('Revenue') directly, it returns Revenue’s own value for non-zero rows.

This pattern is useful when creating binary helper tables or flags for further filtering or visualization.

Using IF(Node) to remove zero values

When a node itself is used as the condition, IF checks whether the value is true (non-zero) or false (zero).

Because IF interprets 0 as false, those entries become N/A in the result.

Input node: Revenue

YearRevenue
20250
2026120
20270
2028300

Formula: IF('Revenue')

Year→ IF Result
2026120
2028300

This technique replaces zeros with N/A values, which can help avoid misleading totals and reduce visible rows in tables and charts.


FunctionWhen to use instead
FILTERRemoves non-matching rows entirely instead of returning an alternative value
TRUE / FALSEBoolean constants usable inside conditions
Was this page helpful?