# Microsoft Word Formulas

While DocExport allows you to output formula results and sum values directly from your monday.com board, **you can also use Microsoft Word's formula fields** to create additional calculations inside your template.

{% hint style="info" %}
Please note: Word formulas work only within the Word environment - they are not calculated on the monday.com board. These formulas will show the correct results only in the DocExport editor preview and the final PDF document.
{% endhint %}

Microsoft offers a comprehensive, official list of all Word field codes — including the formula field and its functions: [Microsoft Support: List of field codes in Word](https://support.microsoft.com/en-us/office/field-codes-formula-field-32d5c9de-3516-4ec3-80ed-d1fc2b5bc21d)

This reference covers everything from basic fields like `{ = (Formula) }` to advanced ones, along with their switches and formatting options.

## How to add Custom Calculations in Word Tables

1. Open your .docx template or create a new one.
2. Click into the table cell where you want the calculation to appear.
3. **Insert a Formula Field.**\
   Click on **'Insert'** in the top menu and select **'Fields'.** \
   You can also press  **Ctrl + F9** (Microsoft) or **\[⌘ + F9]** (Mac) to insert a field. \
   You’ll see curly brackets like this: `{ }`\
   &#x20;
4. Inside the brackets, add a Word formula like:\
   `{ ={{FieldA}}/{{FieldB}} }`\
   &#x20;Click on '**Table Layout'** and select '**Formulas**'.

   <figure><img src="https://1159009676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMnVzL8c1pE5zXO95iUKm%2Fuploads%2Fj3q2dqbD5FoAPAVZmfQS%2Fimage.png?alt=media&#x26;token=f5fb53e4-40ad-4898-a89e-5f0dc1d956d2" alt=""><figcaption></figcaption></figure>
5. **Format the result.** \
   Use the 'Number format' field or add `\#` to your formula to define the output format (e.g., percent, currency, decimal places): \
   `{ ={{FieldA}}/{{FieldB}} \# "0.00%" }`
6. **Update the field.**\
   Right-click the field and choose 'Update field' or press `F9` .
7. Save your document and re-upload the .docx template in DocExport.

<figure><img src="https://1159009676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMnVzL8c1pE5zXO95iUKm%2Fuploads%2F4dTSG9N2ScFMIKIJXSxZ%2Fimage.png?alt=media&#x26;token=cd6fca1b-380c-4530-bb5b-2687e389dfe5" alt=""><figcaption><p>Example: This field should not display the sum, but show <strong>Total Admin / Total Billed Potential</strong> in percentage.</p></figcaption></figure>

## Helpful Tips for Using Mergefield Calculations

1. **Do not** type the curly brackets `{}` manually.\
   → Use the way described above to insert field brackets.
2. If you don´t see your field codes when you open your .docx file, you need to toggle them.\
   To **toggle field codes**, right-click the field and choose '**Toggle Field Codes'.**
3. After editing fields, **always** update them by selecting the field and pressing **F9.**<br>

## Other ways to use Microsoft Word Mergefields

Get inspired by the [list of field codes](https://support.microsoft.com/en-us/office/list-of-field-codes-in-word-1ad6d91a-55a7-4a8d-b535-cf7888659a51?utm_source=chatgpt.com) Microsoft provides. There are plenty more ways of using Mergefields within Microsoft Word templates.\
\
**Example:** Only display a field if it´s not empty. \
\
If {{CustomerNumber}} is **not empty**, the value is displayed. If it's empty, nothing is shown.\
`{ IF "{{CustomerNumber}}" <> "" "{{CustomerNumber}}" "" }`


---

# 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://help.docexport.com/template/advanced-options/microsoft-word-formulas.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.
