Formulas
Formulas calculate values for computed variables. Use them for scores, segment labels, eligibility flags, and derived text that you pipe or evaluate in logic.
When to use formulas
Section titled “When to use formulas”- Sum or average rating questions into an index.
- Label participants as a segment with
IF. - Normalize text with
UPPER,LOWER, orCONCAT. - Gate follow-ups on a derived flag instead of repeating long conditions.
Available functions
Section titled “Available functions”| Function | Purpose | Example |
|---|---|---|
IF(condition, trueValue, falseValue) | Conditional result | IF({{age}} > 18, "Adult", "Minor") |
AND(condition1, condition2, ...) | All conditions true | AND({{age}} > 18, {{country}} = "US") |
OR(condition1, condition2, ...) | Any condition true | OR({{status}} = "active", {{status}} = "trial") |
NOT(condition) | Boolean negation | NOT({{is_premium}}) |
| Function | Purpose | Example |
|---|---|---|
SUM(number1, number2, ...) | Add numbers | SUM({{Q1}}, {{Q2}}, {{Q3}}) |
AVG(number1, number2, ...) | Average | AVG({{Q1}}, {{Q2}}, {{Q3}}) |
MIN(...) / MAX(...) | Extremes | MAX({{Q1}}, {{Q2}}) |
ROUND(number, decimals) | Round to decimals | ROUND({{score}}, 2) |
ABS(number) | Absolute value | ABS({{difference}}) |
CEIL(number) / FLOOR(number) | Round up / down | CEIL({{score}}) |
| Function | Purpose | Example |
|---|---|---|
LEN(string) | Character length | LEN({{name}}) |
UPPER(string) / LOWER(string) | Case transform | UPPER({{name}}) |
CONCAT(string1, string2, ...) | Join strings | CONCAT({{first_name}}, " ", {{last_name}}) |
CONTAINS(string, substring) | Substring check | CONTAINS({{email}}, "@gmail.com") |
How to create a computed variable
Section titled “How to create a computed variable”- Create a variable with type Computed.
- Open the formula editor.
- Insert functions and
{{variable}}references. - Validate the expression in the editor.
- Use the computed variable in piping or conditions.
- Preview with known inputs.
Example
Section titled “Example”Create effort_band from an average of three ratings:
IF(AVG({{ease}}, {{clarity}}, {{speed}}) >= 4, "Low effort", "Needs work")Then show a deep-dive section only when effort_band equals Needs work.
Limitations
Section titled “Limitations”- Inputs must resolve before the formula is useful later in the path.
- Keep formulas readable. Very long nested expressions are hard to maintain.
- Formula results follow the computed variable through logic evaluation order. See How rules are evaluated.
- Store intermediate calculations as separate computed variables when reuse helps.
- Prefer formulas for repeated math instead of duplicating conditions on many questions.
- Test edge cases: empty answers, zero values, and unexpected text.
Common questions
Where do formulas run?
Formulas power computed variables. The result can be piped into text or used in display and branching conditions.
Can I nest functions?
Yes. For example, wrap SUM inside ROUND, or use IF with AND conditions.
How do I reference other variables inside a formula?
Use piping tokens such as {{Q1}} or {{age}} inside the formula expression.