Skip to main content

PivotTable Conditional Formatting: Two Good Methods

Learn two reliable methods for applying PivotTable conditional formatting and avoid common pitfalls.
Apr 4, 2025  · 7 min read

Applying conditional formatting to PivotTables adds value to our data analysis by visually highlighting the most critical data points and enhancing the readability of those tables.

In this tutorial, we'll learn two methods for applying conditional formatting to PivotTables in Excel. We'll also list some nuances and potential issues to keep in mind and how to handle them.

If you need a quick revision of the basics of Excel, our Introduction to Excel course can be a helpful resource for you.

How to Apply Conditional Formatting to PivotTables

There are two methods for applying conditional formatting to PivotTables in Excel:

  • Choosing from the predefined rule types and formats
  • Using a dedicated rule manager.

Both methods start with:

  • Selecting one of the cells to which we want to apply conditional formatting,
  • Opening the Home tab on the Excel ribbon
  • Clicking on the Conditional Formatting button.

The first method is more intuitive and provides preset formats for each rule. The second method is a little more customizable and allows accessing all options, settings, and already-created rules from one place.

To practice both methods, in this tutorial, we're going to work with the below PivotTable based on the source table from Kaggle—Credit Card Spending Habits in India:

A pivot table based on the Credit Card Spending Habits in India table. Image by Author.

Method 1: Using the PivotTable formatting icon

Let's see how to implement the first method: choosing from the predefined rule types, rules, and formats.

  • Select one of the cells of interest in your PivotTable.
  • Open the Home tab on the Excel ribbon.
  • Click on the Conditional Formatting button.
  • Choose the predefined options:
    • Select one of the rule types in bold.
    • Follow the steps that appear to select a rule and a format.
    • Click on the Formatting Options icon that appears to the right of the cell.

You can customize things like the rule type, condition (e.g., greater than or top 10), font color, cell fill color, number formatting, and even icon sets.

How to choose from the predefined conditional formatting rule types and rules. Image by Author.

Choosing from the predefined conditional formatting rules. Image by Author

How to choose from the predefined formats. Image by Author.

Choosing from the predefined formats. Image by Author

How to open the formatting options after setting a conditional formatting rule to one cell in the pivot table. Image by Author.

Opening the formatting options. Image by Author

How to expand a conditional formatting rule to all cells in the pivot table using the Formatting Options icon. Image by Author.

Expanding a conditional formatting rule to all cells. Image by Author

Method 2: Using the Conditional Formatting rules manager

Now, let’s practice applying conditional formatting to our PivotTable by using the second method: setting a rule type, a rule, and a format in a dedicated rule manager.

  • Select one of the cells of interest in your PivotTable.
  • Open the Home tab on the Excel ribbon.
  • Click on the Conditional Formatting button.
  • Use a dedicated rule manager:
    • Select Manage Rules.
    • Click on the New Rule button.
    • Select the third option for the Apply Rule To: section.
    • Select a rule type.
    • Manually set the format.

How to open the Conditional Formatting Rules Manager. Image by Author.

Opening the Conditional Formatting Rules Manager. Image by Author

How to create a new rule in the Conditional Formatting Rules Manager. Image by Author.

Creating a new rule in the Conditional Formatting Rules Manager. Image by Author

How to expand a conditional formatting rule to all cells in the pivot table using the Conditional Formatting Rules Manager. Image by Author.

Expanding a conditional formatting rule to all cells. Image by Author

How to select a rule type, build a rule, and open the format constructor in the Conditional Formatting Rules Manager. Image by Author.

Selecting a rule type, building a rule, and opening the format constructor. Image by Author

How to set format details in the Conditional Formatting Rules Manager. Image by Author.

Setting format details. Image by Author

How to preview the format and confirm the creation of a new rule in the Conditional Formatting Rules Manager. Image by Author.

Confirming the creation of a new rule. Image by Author

Things To Keep in Mind

  1. Conditional formatting is applied directly to the PivotTable. We don't need to apply any conditional formatting to the original Excel table on which our PivotTable is based.
  2. If you change anything to the underlying table, it's necessary to refresh the PivotTable to make sure the conditional formatting is applied to it.
  3. Conditional formatting rules remain valid and work as expected after rearranging the PivotTable layout or applying filters or slicers.
  4. Conditional formatting is lost if we remove from the PivotTable any of the fields to which that formatting was applied.

How to refresh a pivot table with conditional formatting after updating the source table. Image by Author.

Refreshing a PivotTable with conditional formatting after updating the source table. Image by Author

Conclusion

Now it's your turn to practice and experiment with different conditional formatting techniques that can work better in other cases. Our Data Analysis in Excel course is a great place to continue mastering your skills.


Elena Kosourova's photo
Author
Elena Kosourova
LinkedIn

IBM Certified Data Scientist (2020), previously Petroleum Geologist/Geomodeler of oil and gas fields worldwide with 12+ years of international work experience. Proficient in Python, R, and SQL. Areas of expertise: data cleaning, data manipulation, data visualization, data analysis, data modeling, statistics, storytelling, machine learning. Extensive experience in managing data science communities and writing/reviewing articles and tutorials on data science and career topics.

Topics

Learn Excel with DataCamp

Course

Introduction to Excel

4 hr
148.3K
Master the Excel basics and learn to use this spreadsheet tool to conduct impactful analysis.
See DetailsRight Arrow
Start Course
See MoreRight Arrow
Related

blog

Working with PivotTables in Excel

Learn how to organize rows and columns, add values, find the sum of a value, and apply filtering to select a subset of a given dataset. We’ll learn how to apply this in Excel with a retail dataset example.
Jess Ahmet's photo

Jess Ahmet

9 min

Tutorial

Conditional Formatting in Excel: A Beginner’s Guide

Explore conditional formatting in Excel with simple to advanced examples and their best practices.
Joleen Bothma's photo

Joleen Bothma

7 min

Tutorial

Creating and Customizing Pivot Tables in Power BI

Learn how to create customizable pivot tables in Power BI with advanced conditional formatting and some optimization tips.
Joleen Bothma's photo

Joleen Bothma

9 min

Tutorial

Conditional Formatting in Spreadsheets

Learn how to utilize conditional formatting with one or multiple conditions and how to color cells by custom criteria with the help of a dataset.
Aditya Sharma's photo

Aditya Sharma

11 min

Tutorial

Pivot Tables in Spreadsheets

Learn how to organize rows and columns, add values, find the sum of revenue, and finally apply filtering to select a subset of data from a given dataset.
Aditya Sharma's photo

Aditya Sharma

10 min

code-along

Visualizing Sales Data with PivotCharts in Excel

In this code along, we delve into the world of data analysis and visualization using PivotCharts and PivotTables on a sales dataset.
Agata Bak-Geerinck's photo

Agata Bak-Geerinck

See MoreSee More