Summary

To apply conditional formatting to a pivot table, create a new conditional formatting rule and pay particular attention to the "apply rule to" settings as described below. In the example shown, there are two rules applied. The green shows the top 5 values using a rule like this:

Pivot table conditional formatting top 5 values rule

Details

Pivot tables are dynamic and change frequently when data is updated. If you created conditional formatting rules based on "selected cells" only, you may find that the conditional formatting is lost or not applied to all data when the pivot table is changed, or when data is refreshed.

The best option is to set up the rule correctly from the start. Select any cell in the data you wish to format and then choose "New rule" from the conditional formatting menu on the Home tab of the ribbon. At the top of the window, you will see a setting for which cells to apply conditional formatting to. For the example shown, we want the last option: All cells showing "Sum of sales" values for "Name" and "Date".

Pivot table conditional formatting create new rule

Note: The second option, "All cells showing "Sum of Sales values", will include grand total rows and columns as well, which you ordinarily don't want.

Editing existing rules to fix broken formatting

If you already have a rule set up that is not correctly formatting all values as needed, edit the rule and change the cell selection option if needed. You can access existing rules at Home > Conditional Formatting > Manage Rules.

In the example shown, the rule manager displays two rules like this:

Pivot table conditional formatting rule manager

To edit a rule, select the rule and click the "Edit Rule" button. Then adjust settings in the "Apply rule to" section.

Note: conditional formatting is lost when you remove the target field from a pivot table.