Tag IF Statements

Sometimes you might need to insert content inside your document output depending on a source value. To achieve this you can use the IF formula.

=‍IF() - formula

Returns one value if a logical expression is `TRUE` and another if it is `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 reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.

  • value_if_true - The value the function returns if logical_expression is TRUE.

  • value_if_false - [ OPTIONAL - blank by default ] - The value the function returns if logical_expression is FALSE.

The tags included in the brackets don't need to be accompanied by "{{" and "}}"

Contains

You can use ~ in place of the = and the condition will be true as long as the variable text is contained within the comparison text (or vice versa). e.g.

{{=IF(tag name ~ "foo","Tag contains foo", "Tag does not contain foo")}}

This formula would be true if the tag contained "foo"

=SUMIF() - Filter and SUM values

By using the SUMIF formula in a data grouping workflow, you can SUM values based on specific conditions. e.g.

{{=SUMIF(Product Type = "Service", Product Cost)}}

IF Formulas and Data Grouping

=IF() - Find if a value is true per item

By using the =IF() formula within a data grouping table, a condition can be evaluated against each value of a varying field. e.g.

{{=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() - Only display text if there is a value

You can also only display a value if there is any data present by not adding a condiditon to the IF formula, like this {{=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() - Find if a value is included in the whole data set

By using the IFANY formula in a data grouping workflow, a condition can be evaluated against all the values of a varying field. e.g. {{=IFANY(Data Group Value = "Wally", "Found him!", "Nada!")}}

Feedback and feature suggestions

We created Portant in 2021, and the feedback we have received since then has been very helpful and greatly appreciated. If you have any feedback, please feel free to send us an email at contact@portant.co

Thanks,

Blake and James

Last updated