> For the complete documentation index, see [llms.txt](https://support.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.docstudio.com/user/template-builder/template-dynamic-fields/formula-field.md).

# Formula Field

This document explains how to add and configure the Formula field in a template, including operations, arguments, and precision.

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

{% columns %}
{% column %}

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**.
   {% endcolumn %}

{% column %}

<figure><img src="https://2962383972-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqUiFHjwtCCGSaEDqbXb%2Fuploads%2FewPpg592UNJ6w5Yxm38W%2Fimage.png?alt=media&amp;token=13b00afa-cdeb-4bdb-8143-a5370d6e131f" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### 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="https://2962383972-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqUiFHjwtCCGSaEDqbXb%2Fuploads%2FqARTu96q7Q8VRJeIsmqr%2Fimage.png?alt=media&amp;token=18b71b2f-189e-4210-9394-ebac53a0f2c3" 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
