Guide · 5 min read

How to add calculations to a form

Updated 2026-09-17

TL;DR

A calculated field runs a formula that references other fields by ID and updates live as people answer — use it for totals, pricing, and quiz scoring.

Some forms need a number that depends on other answers — an order total, a quote estimate, a quiz score. Rather than making respondents do the math themselves, a calculated field runs a formula in the background and updates the result the moment they answer. This guide covers how the formula syntax works, how to format the output, and where calculations are most useful.

How a calculated field works

A calculated field is read-only: instead of collecting an answer, it derives one from a formula you write once. The formula references other fields by wrapping their ID in curly braces, like ${field_id}, and combines them with addition, subtraction, multiplication, division, and parentheses.

Because it updates live, respondents see the result change as they fill in the fields it depends on — a running total as they add quantities, for example, rather than a number that only appears after submission.

Writing the formula

Formulas support plain arithmetic: ${price} * ${quantity} multiplies two fields, and (${a} + ${b}) / 2 averages two numbers. Fields that hold a list of choices, like a multiple-choice field, are summed if they contain numeric values, which is useful for quiz scoring where each choice is worth points.

The formula parser only understands numbers, field references, arithmetic operators, and parentheses — no functions or external logic, which keeps it predictable and safe to run in the browser.

Formatting the result

A raw calculation result is rarely what you want to show as-is. You can set how many decimal places to display, and add a prefix or suffix so a total reads as a currency amount or a score reads with a unit, like "$" before the number or " pts" after it.

Keep the formatted output focused on what the respondent needs to see — a price total, not a chain of intermediate values.

Common uses

Order and quote forms multiply a unit price by a quantity field, sometimes across several line items added together. Quiz and assessment forms score each answer with a numeric weight and sum them into a final score field shown at the end.

Deposit or fee calculators take one input, like a loan amount or an event headcount, and apply a fixed rate or per-person cost to show an estimate before someone commits to filling out the rest of the form.

What calculations can't do

The formula only reads numeric field values already in the form — it can't call an external API, look up a database, or apply logic like rounding rules beyond decimal places. For anything more complex than arithmetic, a calculated field is the wrong tool.

In YeetForm, the calculated field type supports a safe formula parser with decimals, prefix, and suffix formatting, and it's part of the free plan alongside every other field type.

FAQ

What can a calculated field's formula reference?+
Other fields in the same form, referenced by their field ID inside ${...}, combined with addition, subtraction, multiplication, division, and parentheses.
Can a calculated field show a currency symbol?+
Yes — you can set a prefix (like "$") or a suffix (like " pts") along with how many decimal places to show, so the raw number reads as a price or a score.
Does a calculated field accept manual input?+
No — it's read-only and derived entirely from the formula, so respondents can't type a value into it directly.

Build your form with AI in seconds

Start free