# Formula Field

Use **Formula field** to display a calculated value in a template.

It’s a calculated field. Participants don’t type the value manually.

You can place this field in:

* structured documents
* PDF documents

### Add a formula field

<figure><img src="/files/r7EaGbFCwQdwoUMdDIDw" alt=""><figcaption></figcaption></figure>

1. Open the template in edit mode.
2. In the **Fields** panel find **Formula field** and add it to the template.
3. Configure the field and click **Save**.

### Field settings

Click on the placed field to reopen settings menu.

{% columns %}
{% column %}

* **Name** — field name shown in the document
* **Placeholder** — hint text shown before calculation (if empty, **Name** is used)
* **Tooltip** — additional hint shown on hover
* **Operation** — operation applied to arguments
* **Argument 1** — argument used for calculation
* **Precision** — number of decimal places (leave empty for no limit)
* **Search** — makes the field available for search/filtering in the mailbox UI (if enabled in your setup)
* **Adapt to the local format** — formats numbers using the participant’s region settings
* **Show decimal zeroes** — adds trailing zeroes to match **Precision**
  {% endcolumn %}

{% column %}

<figure><img src="/files/u0WIo3Ke9wnXMU8JltHo" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% hint style="info" %}
You can type a static number directly into an argument field.
{% endhint %}

#### Precision behavior

If the calculated value has more decimals than **Precision**, extra decimals are trimmed.

No rounding is applied.

Example:

* `1.99` → `1.9` when **Precision** is `1`
* `1.99` → `1` when **Precision** is `0`

{% hint style="info" %}
In the envelope view, number formatting depends on the region selected on the **User profile** page.

In printable versions, numbers always use the platform region standard.
{% endhint %}

### Available operations

Operations for any argument fields:

* **SUM** — arguments sum
* **PRODUCT** — arguments multiplication result
* **SUBTRACT** — arguments subtraction result
* **DIVIDE** — arguments division result

Operations for dynamic tables only (select a field from the target column):

* **SUM table column** — column values sum
* **COUNTA table column** — count of non-empty cells
* **MIN table column** — smallest value in the column
* **MAX table column** — largest value in the column

### Supported argument types

You can use these fields as arguments:

* **Number**
* **Currency**
* **Dictionary**
* **Lookup**
* **Duplicate**
* **Formula field**

#### How non-numeric values are parsed

If you use **Dictionary**, **Lookup**, or **Duplicate** as an argument, the value is parsed as a number.

All symbols except digits and the last period are ignored.

If there are several periods, only the last one is treated as the decimal separator.

Example:

* `Abc@/.1.1.1` + `Abc@/.1.1.1` with **SUM** → `22.2`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.docstudio.com/user/template-builder/template-dynamic-fields/formula-field.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
