Conditional Format Pivot Table: How to Apply Rules

Charts & pivot tables · Updated November 23, 2026

Yes, you can apply conditional formatting to a pivot table in Excel. Select the cells you want to format, go to Home > Conditional Formatting, choose a rule, and it will work—but you need to understand how pivot table structure affects the rule’s range and application. The key is whether you format the entire pivot table, a single field, or a specific group of cells, and whether you want the formatting to persist when the pivot table is refreshed or rearranged.

Why Conditional Formatting on Pivot Tables Feels Different

Conditional formatting in a normal range is straightforward: the rule applies to a fixed set of cells. A pivot table, however, is dynamic. Rows and columns can expand, collapse, reorder, or disappear when you refresh data or move fields. If you apply a rule to a range that later changes shape, the formatting may not cover new items or may cover blank cells. Excel does offer a special option for pivot tables: when you select a pivot table and apply conditional formatting, the New Formatting Rule dialog includes a setting called “All cells showing ‘Sum of Sales’ values” (or similar). This option ties the rule to the pivot table’s data area, so it automatically adjusts when the pivot table changes.

How to Apply Conditional Formatting to a Pivot Table

Here are the steps for Excel for Microsoft 365 on Windows. On a Mac, the steps are the same except the ribbon is at the top and some dialog buttons look slightly different.

  1. Click anywhere inside the pivot table to select it.
  2. Go to the Home tab, then click Conditional Formatting > New Rule.
  3. In the New Formatting Rule dialog, select a rule type (for example, “Format only cells that contain”).
  4. Under “Apply rule to,” choose one of the three pivot-specific options:
    • Selected cells – applies only to the cells you selected before opening the dialog.
    • All cells showing ‘Sum of Sales’ values – applies to every cell in that value field, even if rows/columns are added later.
    • All cells showing ‘Sum of Sales’ values for ‘Region’ – applies to the value field but only within the context of a specific row or column field (like Region).
  5. Set your condition and format (e.g., cell value greater than 1000, fill light green).
  6. Click OK. The formatting appears immediately.

If you want to use a formula-based rule, select “Use a formula to determine which cells to format” in step 3. The formula must be written relative to the top-left cell of the selected range. For example, if your pivot table values start at B5, and you want to highlight values greater than 500, the formula would be =B5>500 (assuming B5 is the active cell).

Choosing the Right Rule Type for Your Goal

Your goal determines which rule type works best. Here are common scenarios:

  • Highlight top/bottom values – Use “Format only top or bottom ranked values” and set the number (e.g., top 5). This works well for sales rankings.
  • Color scale for trends – Use “Format all cells based on their values” and choose a 2-color or 3-color scale. This is great for spotting high/low patterns across a matrix.
  • Data bars for quick comparison – Use “Format all cells based on their values” and select Data Bar. This is effective for showing relative magnitude across rows.
  • Icon sets for thresholds – Use “Format all cells based on their values” and pick an icon set (e.g., arrows). This works when you have clear performance tiers.
  • Text-based conditions – If your pivot table has text fields (like product names), use “Format only cells that contain” and specify “text” containing a certain word.

For most pivot tables, the “All cells showing…” option is safer than “Selected cells” because it adapts to changes. However, if you only want to format a specific subtotal or a particular row, “Selected cells” gives you precise control.

Common Problems and How to Fix Them

Conditional formatting on pivot tables often fails or behaves unexpectedly. Here are the most frequent issues and solutions:

  • Formatting disappears after refresh – This usually happens because the rule was applied to a fixed range that no longer matches the pivot table’s new size. Solution: re-apply the rule using the “All cells showing…” option, or check that the range in the rule is correct (select the pivot table, go to Conditional Formatting > Manage Rules, and edit the range).
  • Formatting applies to blank cells – When you use “All cells showing…”, blank cells in the pivot table might get formatted. To avoid this, add a condition like “cell value is not blank” in the rule, or use a formula that checks for non-empty.
  • Formatting doesn’t follow when you move fields – If you drag a field from rows to columns, the rule may not cover the new layout. Use the “All cells showing…” option, which is designed to follow the field, not the cell positions.
  • Rules are grayed out – This can happen if you have the entire pivot table selected and try to apply a rule that doesn’t work on a multi-area selection. Solution: select just the values area (e.g., B5:E10) before applying the rule.
  • Rule applies to the wrong field – If you have multiple value fields (e.g., Sum of Sales and Sum of Profit), the “All cells showing…” option lists each field separately. Make sure you pick the correct one.

Comparing Pivot Table Conditional Formatting with Normal Ranges

The main difference is the “Apply rule to” options. In a normal range, you always apply to a fixed set of cells. In a pivot table, you can choose to apply to the entire data area, which is dynamic. This is both a blessing and a curse: it saves time when the pivot table grows, but it can also cause unexpected formatting if you don’t understand how the rule interprets the pivot table structure. For example, if you apply a color scale to “All cells showing ‘Sum of Sales’ values”, the color scale is computed based on all visible values in that field. If you later filter the pivot table, the color scale recalculates based on the filtered subset, which might change the colors dramatically. In a normal range, the color scale would stay fixed unless you edit the rule.

Costs and Versions: What You Need to Know

Conditional formatting is a standard feature in all desktop versions of Excel, including Excel 2010, 2013, 2016, 2019, and Microsoft 365. There is no extra cost. However, the pivot-specific “Apply rule to” options were introduced in Excel 2010, so older versions (2007 and earlier) do not have them—you would have to use a fixed range and manually update it. In Excel for the web, conditional formatting works, but the pivot-specific options may be limited or missing. As of this writing, Excel for the web does not support creating new conditional formatting rules on pivot tables; you can only view existing ones. For full functionality, use the desktop app.

Alternatives to Conditional Formatting on Pivot Tables

If conditional formatting doesn’t meet your needs, consider these alternatives:

  • Use a PivotChart – A chart can visually highlight trends without formatting cells. For example, a bar chart with data labels can show which products are top sellers.
  • Add a calculated field – Create a calculated field that returns a status like “High” or “Low” based on a formula, then use that field in the pivot table. This gives you a permanent text indicator that you can also use in slicers.
  • Use a separate helper range – Build a formula-based summary table next to the pivot table (using GETPIVOTDATA or SUMIFS) and apply conditional formatting to that helper range. This decouples the formatting from the pivot table’s dynamic behavior.
  • Apply a table style – Pivot table styles (under Design > PivotTable Styles) can add banded rows or borders, which is a simpler way to improve readability without conditional formatting.

Each alternative has trade-offs. Charts are visual but not cell-based; calculated fields are static and require refresh; helper ranges are flexible but add complexity.

Frequently Asked Questions

How do I stop conditional formatting from disappearing when I refresh my pivot table? Use the “All cells showing…” option when you create the rule. That ties the rule to the pivot table field, so it persists through refreshes and layout changes. If you already have a rule on a fixed range, edit it (Home > Conditional Formatting > Manage Rules) and change the “Applies to” range to the entire pivot table data area, or re-create the rule with the pivot option.

Can I apply conditional formatting to only the subtotal rows in a pivot table? Yes, but it’s tricky. Subtotals are part of the pivot table, but they are not part of the “All cells showing…” value field. You need to select the specific subtotal cells (e.g., the row that says “Total”) and apply a rule to “Selected cells”. However, when the pivot table is refreshed, the subtotal rows may shift, so the rule may not follow. A more robust approach is to use a formula that identifies subtotal rows based on the row label (e.g., if the row label is “Total”).

Why does my color scale look different after I filter the pivot table? Because the color scale recalculates based on the visible cells. When you filter, the minimum and maximum values change, so the colors adjust. If you want a fixed scale, you can use a formula-based rule that references a fixed cell containing the max value, or use a normal range with a static color scale.

Does conditional formatting work on pivot tables in Google Sheets? Yes, but the approach is different. In Google Sheets, you apply conditional formatting to a range, and it works similarly to a normal range. However, Google Sheets does not have the “All cells showing…” pivot-specific option. If your pivot table changes size, you need to adjust the range manually or use a dynamic range formula like =OFFSET() or =INDIRECT() in the custom formula rule. For most users, it’s simpler to apply formatting to the entire column/row range that the pivot table might occupy.

Can I use a formula in conditional formatting to compare a pivot table value to another cell? Yes. Select the values area, use “Use a formula to determine which cells to format”, and write a formula that references the top-left cell of the selection. For example, if your pivot table values start at B5, and you want to highlight values greater than the value in cell H1, use =B5>$H$1. Make sure to use absolute references for the comparison cell.

Why does my conditional formatting rule apply to blank cells in the pivot table? This often happens when you use “All cells showing…” because the rule covers the entire value field, including cells that are blank when no data exists. To fix it, add a condition that checks for non-blank. For example, use a formula rule like =AND(B5<>"", B5>500). Alternatively, in the rule dialog, under “Format only cells with”, choose “cell value” and “not equal to” and leave the value blank, but that’s less reliable.

Related

Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.

More in Charts & pivot tables

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.