# Add formula column

The Formula step allows you to create a new column in your dataset by applying a custom formula to existing columns.

### Step parameters

1. `New Column` **(string)\***: Specify the name for the new column that will contain the result of your formula.
2. `Formula`**\***: Enter the formula you want to apply. This can be a mathematical expression, a string manipulation, or a combination of functions. You can reference existing columns in your formula.

### Example

**Input**

<figure><img src="/files/NiWPzk25tZE0PL2bCMnX" alt=""><figcaption><p>Add - Add formula column input</p></figcaption></figure>

**Configuration**

```json
{
    "new_column": "monthly_salary",
    "formula": "salary/12"
}
```

**Output**

<figure><img src="/files/99aux75Qrlg5mPbo3rzN" alt=""><figcaption><p>Add - Add formula column output</p></figcaption></figure>

{% hint style="warning" %}
A column can be referenced by its name without quotes unless they include whitespaces, in such a case you need to use brackets ‘\[]’ (e.g. `[myColumn]`).

Any characters string escaped with quotes (simple or double) will be considered as a string.

The supported operators are : addition (`+`), substraction (`-`), multiplication (`*`), division (`/`), modulo (`%`).
{% endhint %}

{% hint style="info" %}
**Supported operators**

The following operators are supported by the formula step (note that a value can be a column name or a literal, such as `42` or `foo`).

* `+`: Does an addition of two numeric values. **See the `concatenate` step to append strings**
* `-`: Does an substraction of two numeric values. **See the `replace` step to remove a part of a string**
* `*`: Multiplies two numeric values.
* `/`: Divides a numeric value by another. Divisions by zero will return `null`.
* `%`: Returns the rest of an integer division. Divisions by zero will return `null`.
  {% endhint %}


---

# 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-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/add/add-formula-column.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.
