The Wayback Machine - https://web.archive.org/web/20241127055116/https://www.geeksforgeeks.org/pivot-table-conditional-formatting-in-excel/
Open In App

How to Apply Conditional Formatting in a Pivot Table in Excel

Last Updated: 06 Dec, 2023

I

Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

One of the most useful ways to customize the pivot table formatting is using Conditional Formats. Conditional formatting rules can be applied to Pivot tables just like they can be applied to normal data ranges. So by using conditional formatting, we can highlight the cells with a certain color depending on the cell’s value.

Conditional Formatting in Excel
Conditional Formatting

What is Pivot Table Conditional Formatting

In Excel, you have the power to make your data stand out using conditional formatting. This means you can automatically highlight cells that meet certain criteria. For example, you can easily spotlight cells that have values above the average or those that fall below a specific threshold.

Now, when you apply this special formatting to a Pivot table, there is an important step to remember. After you’ve set up your conditional formatting, make sure to tweak the settings so that even after you refresh the Pivot table, the right cells maintain their distinctive appearance. This ensures that your highlighted information remains accurate and up-to-date as your data evolves.

Types of Conditional Formatting in Excel

There are many conditional formats that we can use on our data. Some of them are given below: 

1. Text or value-based formats

In this particular formatting, we have two options available.

  • We can highlight the cells that are greater than or less than any particular number, or are between a particular range, or are equal to a particular number.
Highlight cell Rules
Conditional formatting -> Highlight cell rules

For example, if we take the data on the average temperatures experienced month-wise (in F) and if we want to highlight the cells having temperature greater than 50 F (basically we want to visualize on the months having average temperature greater than 50 F), then we can use conditional formatting.

All months having temperature >50F
All the months having temperature > 50 F
  • Secondly, we can highlight the cells that are the top 10 items or the bottom 10 items or occur in the top 10% or bottom 10% of that particular column.

Top/Bottom Rules

2. Data bars

It is also a great way to visualize relative values. Given below is the same example of average temperature displayed month-wise having the visualization of data bars. 

Data Bars
We see that August has the maximum average temperature

We can also edit this formatting rule by going to the Manage rules option and then select the option of “Show only data bar” if we want only the data bars to be displayed and not the numbers. 

Edit Formatting Rule

Data-Bars
Here only the data bars are shown and not the numbers. 

3. Color scales

A great way to create some heat maps for our data. So we will take the same example of displaying month-wise average temperatures. In this formatting, we will use a Red – White – Blue color scale in which maximum temperatures will be colored red and minimum will be colored blue. 

Color Scales
So we can see that August was the hottest month and January was the coolest one. 

4. Icon sets

In this type of formatting, we use directional arrows, shapes, and various indicators to visualize our data. 

Use Arrows
We use green arrow for values > 67 and red arrow for values < 47.

5. Formula-based rules

We can also create our own rule and apply conditional formatting to them. 

  • These were basically the 5 types of conditional formats that we can use to visualize our data in a more convenient and simpler way.
  • If we want to clear any rule or edit any rule, we can simply go to the option of Clear rules and Manage rules respectively. We can clear any rule that we applied or edit it according to our choice.
Formula Based Rules.
Formula Based Rules

Methods to Apply Conditional Formatting to Pivot Table Cells

There are two methods to apply conditional formatting that make sure conditional formatting works even when there is new data in the backend.

How to Apply Conditional Formatting Using Pivot Table Formatting Icon

This Technique harnesses the power of the Pivot Table Formatting Options icon, which becomes available immediately after you’ve implemented conditional formatting within a pivot table.

Given below is the data set. (First Create a Pivot Table)

Pivot-Table
Pivot table

To employ this method, follow the below steps:

Step 1: Select the Data on which you want to apply conditional formatting.

Step 2: Go to Home and select Conditional Formatting.

Step 3: In conditional Formatting choose Top/Bottom Rules -> Above Average.

Step 4: Now specify the Format.

Specify the Format.
Specify the Format

Step 5: Click OK.

When you follow the above steps, it applies the conditional formatting on the data set. On the bottom right of the data set, you can see the Formatting Options icon.

Select the Icon
Select the Icon

Click on the Icon. It will show following options in a drop down:

  • Selected Cells
  • All Cells Showing “Sum of Sales Amount”
  • All cells Showing “Sum of Sales Amount” values for Name and Product.

Select the last option, So when you add any data in teh back end and refresh the Pivot Table, the additional data would automatically be covered by conditional formatting.

When working with conditional formatting in a pivot table, it’s essential to grasp the significance of three available options, each influencing how your formatting is applied:

Selected Cells:

This Stands as the default choice where conditional formatting solely impacts the cells you manually select. It’s ideal for focusing formatting efforts on specific areas of your Pivot Table, tailored to your immediate requirements.

All Cells Showing “Sum of Sales Amount” Values:

With this option, the conditional formatting encompasses all cells displaying the “Sum of Sales Amount” values. Yet, it’s vital to note a caveat- this approach extends to the Grand total values as well, affecting them with the same formatting.

All Cells Showing “Sum of Sales Amount” Values for Name and Product

Consider the most adept choice in this context, this option delivers comprehensive formatting while sidestepping the Grand Total dilemma. By applying conditional formatting to all values( excluding grand totals), it hones in on the combination of “Name” and “Product”. This strategic approach remains resilient even when additional data is introduced, seamlessly accommodating changes without intervention.

How to Apply Conditional Formatting Using Conditional Formatting Rules Manager

There is an alternative route to applying conditional formatting in Pivot tables using the Conditional Formatting rules manager Dialog Box. This method proves particularly valuable when you’ve already implemented conditional formatting and now seek to modify the existing rules:

Follow the steps to know how to execute this approach:

Step 1: Select the data where you wish to implement conditional formatting within the Pivot table.

Step 2: Naviagte to the “Home” tab, locate the “Conditional Formatting” option, and click over “Top/Bottom Rules”.

Step 3: From the dropdown menu, choose “Above Average”. This initiates the application of conditional formatting.

Step 4: Define the desired format.

Step 5: Click OK.

Step 6: Go back to the “Home” Tab, find “Condiitonal formatting,” and select , “Manage Rules”.

Manage Rules

Step 7: In the ensuing “Conditional formatting Rules Manager” , pinpoint the rule you wish to modify, and select the “Edit Rule” button.

Edit Rule

Step 8: Within the ‘”Edit Rule” dialog box, you ‘ll encounter the same trio of options:

Selected Cells

All cells showing “Sum of Sales Amount” Values.

All cells showing “Sum of Sales Amount” values for Name and Product.

Select the Last option and click OK.

Note: This will apply the conditional formatting to all the cells for ‘Name’ and ‘Product’ fields. Even if you change the backend data, the conditional formatting would be functional.

FAQs on Conditional Formatting in Pivot Table

What is Conditional Formatting in a Pivot Table?

Conditional Formatting in a Pivot table involves applying specific formatting styles, such as font color, background color, and cell borders, to cell based on predefined conditions. This helps highlight patterns, trends, and significant data points within the Pivot Table.

How to apply conditional formatting to a Pivot Table?

Follow the below steps to apply conditional formatting to a Pivot Table:

Step 1: Select the cells

Step 2: Go to Home tab and select Conditional Formatting. You can see a few choices- “Highlighting Cells Rules” or “Top/Bottom RUles”.

Step 3: Specify the format.

Where we can use Conditional formatting in Pivot table?

Conditional formatting is valuable for scenarios like:

  • Identifying top or bottom values within categories.
  • Highlighting values that exceed a certain threshold.
  • Emphasizing variations in data through color scales.
  • Spotting outliers or anomalies in the data.

How to modify or remove conditional formatting rules from a Pivot Table?

Follow the steps to modify or conditional formatting rules:

Step 1: Select the cells that you want to change the Special Formatting.

Step 2: Go to Home-> Conditional Formatting-> Manage Rules.

Step 3: In the “Conditional Formatting Rules Manager”, you can edit to even get rid of rules that are no longer needed.



I

News
Improve
Discuss

How to Create Pivot Chart from Pivot Table in Excel using Java?

A Pivot Chart is used to analyze data of a table with very little effort (and no formulas) and it gives you the big picture of your raw data. It allows you to analyze data using various types of graphs and layouts. It is considered to be the best chart during a business presentation that involves huge data. To add a pivot chart to an Excel worksheet, you need to use the "WorksheetChartsCollection.add" method.  Before Creating a Pivot Chart, one first needs to go through how to Create Pivot Table in Excel using Java. Now let's discuss the steps to create a pivot chart in an Excel file in Java using Free Spire.XLS for Java API. How to Create a Pivot Table in Excel using JavaStep 1: Load the Excel fileWorkbook workbook = new Workbook() String workbookName = "Geeks_For_Geeks.xlsx"; workbook.loadFromFile(workbookName); Step 2: Get the first worksheetWorksheet sheet = workbook.getWorksheets().get(0); Step 3: Get the first pivot table in the worksheetIPivotTable pivotTable = sheet.getPivotTables().get(0); Step 4: Add a clustered column chart based on the pivot table to the second worksheetChart chart = workbook.getWorksheets().get(1).getCharts().add(ExcelChartType.ColumnClustered, pivotTa
Read More

I

How to Apply Conditional Formatting Based On VLookup in Excel?

VLOOKUP is an Excel function to lookup data in a table organized vertically. VLOOKUP supports approximate and exact matching, and wildcards (* ?) for partial matches. Conditional Formatting Based on Vlookup: 1. Using the Vlookup formula to compare values in 2 different tables and highlighting those values which is only present in table 1 using conditional formatting. We have a Table containing old products of any grocery shop in 'Old Product' sheet and an updated table having new products in worksheet 'New'. We want to highlight rows in New table containing those items which are not in Old Product Table. Select the data from New table except the Headers. (The table in which we want to highlight rows.)Go to Home->Conditional Formatting->New Rule. In the dialog box appeared, Select the rule type - "Use a formula to determine which cells to format;";Under Edit the rule description enters the following formula: =ISNA(VLOOKUP($A2,'Old Product'!$A$1:$B$8,1,FALSE))Then click Format. Formula explanation: Inside VLOOKUP, 1st parameter is $A2 which is first name in New table.2nd parameter is Old Product Table.3rd parameter is column we want to compare which is 1 as we want to compare i
Read More

Excel Table Styles and Formatting: How to Apply, Change and Remove

article_img
In Excel, you can format tables using various styles, colors, fonts, and other visual elements to make your data more organized and visually appealing. However, there may be situations where you want to remove all the formatting from a table and revert it to its default appearance. Have you ever felt stuck in the maze of Excel tables? Let’s break free together! Discover the straightforward way to remove table formatting in Excel. No more complications—just a quick and easy guide to make your data dance without the formatting fuss. Ready to embark on this hassle-free journey? Let’s get started! Excel Table StylesIn Microsoft Excel, table styles are predefined formatting sets that allow you to quickly and easily apply a consistent and professional look to your data tables. These styles include various formatting elements such as bold headers, alternating row colors, and distinct column formatting. Here's a short note on Excel table styles: How to Choose a Table Style When Creating a TableStep 1: Launch Your Excel SpreadsheetTo Apply Excel table formatting you have to open your Excel spreadsheet from which you want to remove table formatting. Step 2: Select the Data Select the data fo
Read More

Conditional Formatting in Excel

article_img
Conditional Formatting in Excel is a game-changer for anyone dealing with large datasets. This feature allows you to automatically apply formatting, such as colors and icons, to cells that meet specific criteria. With conditional formatting Excel formulas, you can customize your data presentation and highlight key information effortlessly. Whether you need to create a heatmap, highlight duplicates, or show trends, conditional formatting in excel with formula makes it simple and effective. Moreover, you can even apply conditional formatting in Excel based on other cells, enabling dynamic and interactive data visualization. Unlock the full potential of your data with conditional formatting Excel and transform the way you analyze information. Table of Content What is Conditional Formatting in ExcelTypes of Conditional Formatting VisualisationWhere is Conditional Formatting in ExcelHow to Use Conditional Formatting in ExcelHow to Use a Preset Rule with Custom FormattingHow to Create a New Conditional Formatting Rule in ExcelHow to Edit Conditional Formatting Rules in ExcelConditional Formatting Excel Formula ExamplesHow to Find Duplicates in Excel How to Highlight Cells with Value Grea
Read More

I

How to Remove Pivot Table But Keep Data in Excel?

In this article, we will look into how to remove the Pivot Table but want to keep the data intact in Excel. To do so follow the below steps: Step 1: Select the Pivot table. To select the table, go to Analyze tabSelect the menu and choose the Entire Pivot Table. Step 2: Now copy the entire Pivot table data by Ctrl+C. Step 3: Select a cell in the worksheet where you want to paste the data. Step 4: Click Ctrl+V, to paste the data. Step 5: Click on the Ctrl dropdown. Choose the value(v) option from Paste options. Step 6: Now, again select the entire Pivot table. Step 7: Delete it using the Delete key on the keyboard. Step 8: Or you can also choose the Clear All command from the Home tab => Editing section => Clear dropdown. You will find your pivot table will be completely deleted from the worksheet. Thus, we can delete the pivot table without losing pivot table data.
Read More

How to Delete a Pivot Table in Excel?

article_img
A pivot table is a tool in Excel that allows you to quickly summarize data in the spreadsheet. When it comes to deleting a Pivot Table, there are a few different ways you can do this. The method you choose will depend on how you want to delete the Pivot Table. 1.Delete the Pivot Table and the Resulting Data. Steps to delete the Pivot table and the Resulting Data- Select any cell in the Pivot TableSelect the ‘Analyze’ tab. Click on the ‘Select’ option in the Actions group.Choose Entire Pivot tableHit the Delete key.2.Delete the Pivot Table but Keep the Resulting Data. If we want to delete the entire pivot table but retain the resulting data, the procedure is more or less the same Steps to delete the Pivot table but Keep the Resulting Data: Select any cell in the Pivot TableChoose the ‘Analyze’ tab in the ribbon. In the Actions group, choose the ‘Select’ option. Select the Entire Pivot table. Right-click on any cell of the selected Pivot Table.Click on Copy. This will copy the data of the entire Pivot Table. Click the Home tab. Click on the Paste option. In the Paste Values section, click on the first icon. The above steps would delete the Pivot Table but still keep the resulting dat
Read More

I

Refresh Pivot Table Data in Excel

In the Pivot data table, data can be grouped based on Dates, Numbers, and Text values. In the case of dates, we can group dates by months or year, months by years, etc. At any time, data for the PivotTables in your workbook can be refreshed using the Refresh button. You can also refresh data from a source table in the same or a different workbook. By default, PivotTables are not refreshed automatically when data in the source table is changed, but you can set your workbook to refresh its PivotTable data automatically when you open it. Steps to Manually refresh: Follow the below steps to manually refresh PiviotTable Data in Excel: Click on the PivotTable to show the PivotTable Tools on the ribbon. In PivotTable Tools, Click Analyze > Refresh, or press Alt+F5. Click the Refresh button on the Analyze tab (Click Analyze > Refresh All, to update all PivotTables in your workbook at once). If refreshing takes longer, click Analyze > Refresh arrow > Refresh Status to check the refresh status.To stop refreshing, click Cancel Refresh.Steps to prevent column width and cell formatting while refreshing: Follow the below steps to prevent column with and cell formatting while refreshi
Read More

How to Remove Old Row and Column Items from the Pivot Table in Excel?

article_img
Pivot table is one of the most efficient tools in excel for data analysis. If you are using pivot tables frequently, then you will find even after deleting the old data from the data source, it remains in the filter drop-down of the pivot table. We will learn, how to remove the old row and column items from the pivot table in excel. Reason for not removal of the old dataTo better understand, why the data is not removed in the pivot table, even after removing it from the source data, you need to understand the architecture of the pivot table. Internally, the pivot tables have a pivot cache, where the copy of the source data is held. This is done to faster the data retrieving process from the source to the pivot table. Whenever you refresh the pivot table, it gets updated from the pivot cache and not the source data. So, the pivot cache has its properties and default behavior. One of the default behavior, of pivot cache, is that it does not delete the old rows or columns from the filter drop-down. It is a default setting which can be changed very easily. Removing Old rows and columns from the Pivot table Given a table students and their marks. A pivot table is also made from the give
Read More

How to Add and Use an Excel Pivot Table Calculated Field?

article_img
Excel pivot tables are one of its most helpful features. They are utilized to summarize or aggregate large quantities of data. The data can be summarized using the average, the count, or other statistical approaches. It summarizes a large amount of data into a few rows and columns. They make it simple to explore the data from various views and angles and are excellent for data exploration. When you create a Pivot table, you often need to add more data and calculations to your analysis. If you require a new data point that can be obtained by leveraging existing data points in the Pivot Table, you don't need to go back and add it to the source data. Instead, you can utilize a Pivot Table Calculated Field to accomplish this. Pivot Table Calculated Field The "Pivot Table calculated field" option allows you to insert more data or calculations in the pivot table. For our reports, we frequently need to include our own unique calculations that can relate to other fields in the data collection. Benefits of using a Pivot Table Calculated FieldIt is scalable since it will automatically account for any new data added to your Pivot Table. You can utilize a Calculate Field in your Pivot Table ju
Read More

How to Troubleshoot and Fix Excel Pivot Table Errors?

article_img
Power Pivot is an Excel add-in, a data modeling technology that helps the user to create data models, establish relationships, and create calculations. However, it is possible to encounter a few errors during the process. here in this article, we will discuss some of the Excel Pivot Table Errors that may occur and how we can fix them. Usually, Excel Pivot works smoothly and efficiently, however, it is inevitable to encounter some errors while working with the software. Here are some of the common errors that users might encounter during working with Excel PowerPivot. "Unable to load the Data Model" Error Sometimes, A simple data change, for example, adding the pivot table data to the Data Model may cause a pivot table refresh error. It’s not that common, however, sometimes users do face such issues. As we can see in the image below: Here, in the image, as we can see above the message is showing that the “PowerPivot is unable to load the Data Model”. Solution: The change from the UPPER case to the PROPER case or other similar changes in the source data headings may be the primary cause of this error resulting in the data model having a second instance of the field. As shown in the i
Read More
three90RightbarBannerImg