/Calculated variables (formulas)

Calculated variables (formulas)

Compute values from a form's answers โ€” price totals, custom scores, or joined-up text โ€” with a formula on a variable.

What a formula does#

A formula is a way to set a variable's value by combining other answers and variables with arithmetic or text. On the Variables page, give a rule the "set to" action (=) โ€” or use it as the variable's Initial value โ€” and the source picker turns into a formula editor. The result updates live as the respondent fills the form.

Write a formula#

In the formula box, type @ to pick a field or variable โ€” it drops in as a chip. Type the operators and numbers around those chips. Don't type a reference's name by hand; always pick it from the @ menu so it resolves.

@price * @qty + 5
(@subtotal + @fee) * 1.09
@first + " " + @last
Value, reference or formula
Use the hint next to the field for a reminder of the syntax. Multiply with * (not the letter x); you can also paste ร— and รท and they'll be understood.

Number vs text formulas#

  • Number variables โ€” arithmetic with + - * / and parentheses ( ), plus a leading minus (e.g. -5 + 2). Precedence is normal: * and / bind tighter than + and -. The @ menu offers only numeric references.
  • Text variables โ€” join pieces with +. References resolve to their text, "quoted literals" pass through verbatim, and you can reference any field. Arithmetic operators are ignored in text mode.
A variable's type (Number or Text) is fixed when you create it, because it changes what the operators mean.

How it evaluates#

Formulas run entirely in the respondent's browser, alongside the rest of your variables. A half-typed formula or a deleted reference never breaks the form โ€” it just yields 0 (number) or empty text until it's valid again. Dividing by zero leaves the value unchanged rather than producing an error, and the editor flags an invalid number formula with a red border.

Comparisons and conditions don't go inside a formula. To make a value depend on a condition, gate the rule with its "When" condition instead โ€” see Variables and Conditional logic.

Use cases#

  • Price and order totals โ€” quantity ร— unit price, add fees, apply a tax multiplier. Currency-formatted answers like "$1,200.50" are read as numbers automatically.
  • Custom scoring โ€” build a score from answers when the built-in Quiz mode isn't the right fit. A checkbox answer counts as the number of boxes ticked.
  • Composed text โ€” stitch answers into a full name, a summary line, or a reference string you show back to the respondent or send to an integration.