# Formulas

### Overview

Custom formulas in Agentnoon allow you to define new calculated fields using existing attributes in your data - such as compensation - in natural language. These formulas can be used to model costs, estimate severance, apply benchmarks, or capture any custom logic specific to your planning needs. Formulas help turn raw data into actionable metrics.

### Setting up a Custom Formula

1. **Creating a formula:** Navigate to the Attributes and Formulas section and click Add New Formula. Give your formula a clear, recognizable name.
2. **Use variables from your data:** From the Available Variables panel, select the data fields you want to include - such as Level, Service\_Years, or Full\_Compensation.
3. **Write your formula logic:**
   * Use basic math operations, existing variables, and conditional logic to define your formula. Conditional logic allows you to apply different rules based on specific conditions.
   * You can use supported functions like ifElse, in, min, max, and arithmetic operations.

<figure><img src="/files/5ixGDtv0Hf9FHi0IsaAV" alt=""><figcaption></figcaption></figure>

**Example:**\
\
Suppose you need to calculate severance for employees marked as "RIF" (Reduction in Force).\
The formula could be structured as:\
ifElse(in("RIF", \[scenarioState]), max(min(\[Service\_Years], 25), ifElse(\[Level] <= 7, 5, ifElse(\[Level] <= 12, 7, 19))), 0) \* (\[Full\_Compensation] / 25)\
\
This formula considers service years and employee level to determine the severance amount, ensuring precise calculations based on your specific criteria.

<figure><img src="https://19874675.fs1.hubspotusercontent-na1.net/hubfs/19874675/image-png-Dec-12-2024-04-52-34-8159-PM.png" alt=""><figcaption></figcaption></figure>


---

# 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://docs.agentnoon.com/admin-capabilities/overview-2/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.
