Tag if statements
Use an IF formula inside a tag to show different content depending on a value from your source. Helpful for things like swapping a salutation, hiding a section when a field is empty, or labelling a row based on its data.
If statements run inside the document body. To decide whether a document gets generated at all, see conditional logic for documents.

=IF() formula
Returns one value if a logical expression is TRUE, and another if it's FALSE.
Sample usage
{{=IF(tag name = "Hello", "Tag says hello!", "Tag is something else")}} -> Tag says hello!
{{=IF(tag name, "Tag was true", "Tag was false")}} -> "Tag was false"
{{=IF("TRUE", 4, 5)}} -> 4
Syntax
{{=IF(logical_expression, value_if_true, value_if_false)}}
logical_expression: An expression or a reference to a field that evaluates toTRUEorFALSE.value_if_true: The value the function returns iflogical_expressionisTRUE.value_if_false(optional, blank by default): The value the function returns iflogical_expressionisFALSE.
Tags inside the brackets don't need
{{and}}around them.
Contains
Use ~ instead of = to check whether one string contains another (in either direction).
{{=IF(tag name ~ "foo", "Tag contains foo", "Tag does not contain foo")}}
This formula is true if the value of tag name contains "foo".
=SUMIF() filter and sum
In a data grouping workflow, SUMIF adds up values that meet a condition.
{{=SUMIF(Product Type = "Service", Product Cost)}}
IF formulas and data grouping
=IF() check each item
Inside a data grouping table, =IF() evaluates the condition against each value of the varying field.
{{=IF(Data Group Value = "Wally", "Found him!", "Nada!")}}
For example:
| Data Group Value | Formula |
|---|---|
| {{Data Group Value}} | {{=IF(Data Group Value = "Wally", "Found him!", "Nada!")}} |
would produce:
| Data Group Value | Formula |
|---|---|
| Wally | Found him! |
| Nada! | |
| Waldo | Nada! |
=IF() show text only if there's a value
Leave the condition out to show a value only when the field has data:
{{=IF(Data Group Value, "Data present", "")}}
For example:
| Data Group Value | Formula |
|---|---|
| {{Data Group Value}} | {{=IF(Data Group Value, "Data present", "")}} |
would produce:
| Data Group Value | Formula |
|---|---|
| Wally | Data present |
| Waldo | Data present |
=IFANY() check across the whole data set
In a data grouping workflow, IFANY evaluates the condition against every value of the varying field, not each one individually.
{{=IFANY(Data Group Value = "Wally", "Found him!", "Nada!")}}
Related
- Conditional logic for documents controls whether a document is generated at all, based on the data.
- Tag formulas covers the full set of formulas you can use inside a tag.