> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invoca.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a Formula to a Search

> Add a formula directly within a search to perform math, handle null values, or add conditional logic.

You can add a formula directly within a search. Common reasons to use a formula in a search include performing mathematical functions, checking for and replacing null values, or adding conditional logic.

To create a formula in a search:

1. Start a new search, or choose an existing Dashboard Tile from a Dashboard to edit.

2. If the Dashboard Tile shows a chart, switch to **Table View**.

3. In the upper-right of the table, click the **more options** icon and select **Add formula**.

4. Name and enter your formula in the Formula Builder.

   <Note>
     **Note**

     Formula elements are color coded by type and can include the formula operators and functions (blue), the names of columns (purple), and/or constants (black).
   </Note>

5. Click **Formula Assistant** to see a list of formula operators with examples. Expand a category, such as **Operators**, and click an operator for a definition and example.

6. To change what your formula returns, use **Advanced settings**. Depending on your formula, you may be able to change:
   * **Data type**: the type of data the formula generates — for example, use `date` for an `add_days` formula.
   * **Measure or attribute**: whether the formula's output is a Measure or an attribute.
   * **Aggregation**: the default aggregation of the formula's output — for example, choose `min` to see minimum profit.

7. Click **Save**. Name your formula, if you haven't already.

## Where to go next

* [Formula function reference](/s/article/formula-function-reference)
* [View or edit a formula in a search](/s/article/view-or-edit-a-formula-in-a-search)
