> For the complete documentation index, see [llms.txt](https://docs.phocassoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.phocassoftware.com/flex-modes/customize-the-grid/apply-conditional-formatting.md).

# Apply conditional formatting

Use conditional formatting to quickly highlight specific values in the grid.

{% hint style="info" %}
User permission: **Query**
{% endhint %}

Apply formatting rules to change the text or background color of cells based on values. This formatting makes it easier to interpret the data visually and lets you spot trends and anomalies without needing to filter or sort. It's particularly useful in grids that contain a lot of data, where key insights can be easily lost.

{% embed url="<https://phocassoftware.wistia.com/medias/906bsr27yz>" %}
Apply conditional formatting
{% endembed %}

You can define different formatting rules for the grid, matrix, and transactions views, giving you the flexibility to create separate visual cues that suit each one. All your rules are included when you save a favorite, making it easy to retain your personalized formatting for future analysis.

When you [export](/flex-modes/save-and-share-your-work/copy-or-export-data.md) the data to Excel, your conditional formatting is applied, ensuring consistency between what you see in the grid and in the Excel output. The rules are generated automatically with static values, so while you can view the formatting, you can’t modify the rules directly in Excel.

## Remove default highlighting

By default, cells with zero values or no data are highlighted in light blue.

To remove this highlighting, open the **Conditional formatting** panel and clear **Highlight zero and empty cells**. Select it again to restore the highlighting.

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2F2MZi3jadbYGjctZwIsAU%2Fimage.png?alt=media&amp;token=b5f00406-a644-4bcd-9d58-a12c1c0daebc" alt=""><figcaption></figcaption></figure>

## Add rules <a href="#add-rules" id="add-rules"></a>

1. Click the **Conditional formatting** <img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/FOpAN2uPaQTzne74lTGY/conditional-formatting.png" alt="" data-size="line"> button in the top-right toolbar above the grid.
2. In the **Conditional formatting** panel, click **Add rule**.
3. Select the rule type:
   * **Classic:** Highlight cells based on a condition, such as values greater than a set number, above average, or in the top 10%.
   * **Comparative:** Compare values in a specific column against another column or a number. See [Use a comparative rule](#use-a-comparative-rule) below.
4. Select the column(s) to which you want to apply the formatting.
5. Select the condition, then configure it as required.
6. Select the text and background colors applied when the condition is met.
7. Click **Apply**. The new formatting is applied to the grid.
8. Review the formatting in the grid to ensure it looks as expected.
9. Repeat the above steps to add more rules. You can [change the order of rules](#change-the-order-of-rules) to control which formatting takes priority.
10. When you finish setting up the conditional formatting, click **Close**. You can reopen this panel at any time to make changes.
11. [Save your view as a favorite](/flex-modes/save-and-share-your-work/save-and-share-favorites.md) to retain the formatting for next time.

{% hint style="warning" %}
If you change your view of the grid, some formatting might not make sense. For example, if you apply rules to the Total column when the Sales Rep dimension is selected, then click the Product dimension, the formatting might not make sense because the total values are different.
{% endhint %}

### Examples: Highlight sales performance

Use conditional formatting to apply a traffic light color scheme, highlighting sales values against set thresholds or identifying your top and bottom performers.

#### A. Highlight sales against a target

Suppose you want to quickly see if your Sales Reps are meeting the sales target.

This example uses Variance mode to compare the current month's sales with the previous month.

1. In the **Conditional formatting** panel, add a rule, then:
   1. Select **The whole grid** under Columns.
   2. Select the **Greater than** condition and enter **100000**.
   3. Choose green text formatting.
2. Add another rule:
   1. Select **The whole grid** under Columns.
   2. Select the **Less than** condition and enter **80000**.
   3. Choose red text formatting.
3. Click **Apply**.

The results highlight sales values above 100,000 in green and below 80,000 in red. Values between these thresholds remain unchanged.

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2F5a3L6HRzLNUmjl91ori0%2Fimage.png?alt=media&amp;token=e4a7a748-dd1f-4374-965b-d124b3b3afd8" alt=""><figcaption></figcaption></figure>

#### B. Identify top and bottom performers

Suppose you want to quickly identify your highest and lowest performing sales reps against the budget.

This example uses Stream mode with the Budget stream as the variance. It reviews the previous month's data.

1. In the **Conditional formatting** panel, add a rule, then:
   1. Select the **Budget** column.
   2. Select the **Top** condition, enter **20**, and select **Percent**.
   3. Choose yellow formatting.
2. Add another rule:
   1. Select the **Budget** column.
   2. Select the **Bottom** condition, enter **10**, and select **Percent**.
   3. Choose red formatting.
3. Add another rule:
   1. Select the **Budget** column.
   2. Select the **Top** condition, enter **10**, and select **Percent**.
   3. Choose green formatting.
4. Click **Apply**.

The results highlight the top 10% of performers in green, the next 10% in yellow, and the bottom 10% in red.

{% hint style="info" %}
The [order of rules](#change-the-order-of-rules) matters here. The Top 10% rule is placed below the Top 20% rule so that green formatting takes priority for the highest performers. If you reverse these rules, the Top 20% rule takes priority and all top 20% of performers are highlighted in yellow.
{% endhint %}

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2FMiAbku3sdVRflJGXraSI%2Fimage.png?alt=media&amp;token=b8473e5e-ffc4-4434-b848-fd030f66dfcf" alt=""><figcaption></figcaption></figure>

## Use a comparative rule

Use a **Comparative** rule to highlight differences between periods, compare actual sales against budget, or identify values above or below a target. You can compare a column against another column or a number.

### Compare values between columns

Select the column you want to format, choose a condition, then select another column in **Column or Number** to compare it against.

For example, highlight March sales in red when they are greater than April sales.

<div align="left"><figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2FBugd3ji1WQNqymqhl0nR%2Fimage.png?alt=media&amp;token=130e8927-c6e1-4568-b50c-fe0ff97f7613" alt="" width="563"><figcaption></figcaption></figure></div>

### Compare values against a number

Select the column you want to format, choose a condition, then enter a number in **Column or Number**.

For example, highlight March sales in red when they are greater than 100,000.

<div align="left"><figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2Fz96RL0xD6RTQRmNNRaBC%2Fimage.png?alt=media&amp;token=47f57d66-2689-4533-966c-8d754de27453" alt="" width="563"><figcaption></figcaption></figure></div>

## Change the order of rules

The order of your conditional formatting rules matters when more than one rule applies to the same cell.

Rules are applied from top to bottom. If multiple rules apply to a cell, the last applicable rule takes priority and determines its formatting.

To change which rule takes priority, drag the rules up or down the list, then click **Apply**.

For example, suppose you want to highlight values greater than 900,000 in yellow and values greater than 1,000,000 in green. Both rules apply to values greater than 1,000,000, so their order determines which color is displayed.

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2FpxJ1LEHbWrE47KLCp5D6%2Fimage.png?alt=media&amp;token=59aed552-ea89-4964-bb29-f05a8dbc9767" alt=""><figcaption></figcaption></figure>

* **Image 1:** The green rule is first and the yellow rule is second. The yellow rule takes priority, so all values greater than 900,000 are highlighted in yellow.
* **Image 2:** The yellow rule is first and the green rule is second. The green rule takes priority for values greater than 1,000,000, while values between 900,000 and 1,000,000 remain yellow.

To get the intended result, place the more specific rule below the broader rule.

For another example, see [Identify top and bottom performers](#b.-identify-top-and-bottom-performers) below.

## Edit or delete rules

Click the **Conditional formatting** button to open the panel and view the existing rules.

* **Edit a rule**: Change the settings as required.
* **Delete a rule**: Click the **X** button at the top right of its card.
* **Delete all rules**: Click **Clear all rules**.

Click **Apply** to save your changes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.phocassoftware.com/flex-modes/customize-the-grid/apply-conditional-formatting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
