# Calculated fields

Compute a number from other answers and store it with the response.

A calculated field stores a number the form computes from other answers. Respondents cannot type in it.

You write an expression. The form definition keeps that expression. Each response stores the computed number after submit.

*Number questions and a calculated field that multiplies their ids.*

Use a calculated field when you need a stored number, such as:

- A line total, for example quantity times unit price.
- A simple score from number answers.
- A rounded fee or tax.

> The public form does not update the number while the person types. Preview stays blank. The value appears in Responses after submit. This is not a quiz grader.

How to add one:

1. Add the number questions you want to use.
2. Insert Calculated fields from Advanced, or type /calculated.
3. Copy each question id. The id sits under the label and looks like quantity or unit_price.
4. Type those ids in the expression box, with numbers and + - * /.
5. Leave Required off. The browser checks required before the server computes the value.

*Insert menu open on Calculated fields in the Advanced group.*

The expression can use field ids, numbers, parentheses, and these operators.

| Token | Meaning |
| --- | --- |
| + - * / | Add, subtract, multiply, divide. |
| min(...) | Smallest argument. |
| max(...) | Largest argument. |
| round(...) | Nearest integer. Extra arguments are ignored. |

```
qty * unit_price
round(subtotal * 1.2)
max(0, qty - allowance)
```

Replace qty, unit_price, subtotal, and allowance with the ids under those questions.

> Put the calculated field below the questions it reads. The form computes blocks from top to bottom. A missing or non-numeric answer counts as 0. Divide by zero returns 0.

You will find this block in the Advanced group. See Question types for the full catalog.

## Sitemap

- Home: https://requestforms.io/
- Website forms: https://requestforms.io/website-forms
- Pricing: https://requestforms.io/pricing
- Docs: https://requestforms.io/docs
- Blog: https://requestforms.io/blog
- Tools: https://requestforms.io/tools
- OpenAPI: https://requestforms.io/openapi.json
- llms.txt: https://requestforms.io/llms.txt
- XML sitemap: https://requestforms.io/sitemap.xml
