# Conditional Formatting

{% hint style="info" %} <img src="/files/4VOWezxnwO2wM4J3bVdr" alt="" data-size="line"> This is a [Mito Pro](https://www.trymito.io/plans) feature. [Upgrade](https://www.trymito.io/plans) to highlight important data with ease. <img src="/files/4VOWezxnwO2wM4J3bVdr" alt="" data-size="line">&#x20;
{% endhint %}

Conditional formatting makes it easy to highlight certain values or make particular cells easy to identify. It changes the appearance of a cell based on a condition. You can use conditional formatting to highlight cells that contain values which meet a certain condition.

### Adding Conditional Formats

1. Open the **Home** tab of the toolbar.
2. Click **Conditional Formatting** in the toolbar.
3. Click **Add Conditional Formatting Rule.**&#x20;
4. Click on the newly added rule to configure it:
   1. Select the **Columns** to apply the conditional format within.
   2. Select the filter condition **Where** the conditional format should apply.
   3. Set the **Text Color** and **Background Color** to apply to the cells identified by this condition.

<figure><img src="/files/ApHhC1jYJztYhwvOFT7N" alt=""><figcaption><p>A conditional format being applied to the column X to highlight values over 7.</p></figcaption></figure>

#### Adding Multiple Conditional Formats

Conditional formatting rules will be applied in-order, with later conditional formatting rules overwriting earlier ones. For example:

1. First conditional format sets cells >= 7 to have a red background color.
2. Second conditional format sets cells >= 8 to have a blue background color.

All cells equal to 7 will have a red background. All cells >= 8 will have a blue background color, as this rule is later, and so will overwrite the first conditional format.

#### Invalid Conditional Formatting Rules

Not all conditions can be applied to all columns. For example, if you are adding a conditional format to a number column, but you use the **string starts with** condition to select cells, this will error.

If the conditional formatting rule cannot be applied, it will display an error message prompting you to update the filter condition.&#x20;

### The Generated Styling Code

To view the dataframe with conditional formats in your notebook, simply display the styling object generated by Mito:

<figure><img src="/files/Yhbqhbw7KUKyCpMspYkt" alt=""><figcaption><p>The styling code generated by Mito, plus a line of code that displays the styled object.</p></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.trymito.io/how-to/formatting/conditional-formatting.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.
