Pivot Table Issues

How to Highlight Matching PivotTable Data with Conditional Formatting or VBA

Phi Hung VoPhi Hung Vo Oct 23, 2026 869 views

Question details

The user needs to compare specific data criteria (such as State, Loss Month, Loss Day, and Reported COL) across different worksheets and highlight the matching records inside a PivotTable.

How to Highlight Matching PivotTable Data Using VBA or Conditional Formatting
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Comparing specific column values from a secondary worksheet against a PivotTable and dynamically highlighting the matched data.
Observed behavior
The user wants the matching PivotTable records to be highlighted automatically and for the formatting to persist even after the PivotTable is refreshed.
Before you start

Ensure your PivotTable is fully updated and identify the specific criteria columns (e.g., State, Loss Month) you want to compare before applying any formatting rules or running macros.

Solution 1Recommended

Use Conditional Formatting to Highlight PivotTable Data

Conditional formatting is the easiest to maintain and ensures that highlights persist even after the PivotTable is refreshed.

Applying conditional formatting directly to the PivotTable structure rather than specific cell coordinates prevents your rules from breaking or shifting when new data is added and the table is refreshed.

1
Select the PivotTable Range

Click inside the data area of your PivotTable where you want the conditional highlighting to be applied.

2
Access Conditional Formatting

Navigate to the 'Home' tab on the ribbon menu, click on 'Conditional Formatting', and select 'New Rule' from the dropdown list.

3
Apply Formatting Rules

Select the option to use a formula to determine which cells to format. Enter a formula that cross-references the matching criteria (State, Loss Month, etc.) on Sheet2. Choose your desired highlight color under the 'Format' button and click 'OK'.

4
Adjust Rule Settings for Refresh

To ensure the formatting does not disappear after a refresh, click 'Conditional Formatting' > 'Manage Rules'. Edit your new rule and select the option to apply it to 'All cells showing [Field Name] values' rather than a static cell range.

Use Conditional Formatting to Highlight PivotTable Data
WPS Spreadsheet Solution

Highlight PivotTable Data Easily in WPS Office

WPS Spreadsheet provides robust, easy-to-use Conditional Formatting tools and full VBA/Macro support to help you highlight matching PivotTable data without hassle. It is fully compatible with Microsoft Excel formats.

  1. 1. Open Your Workbook in WPS: Launch WPS Spreadsheet and open your existing Excel workbook containing the PivotTable and your secondary data sheet.
  2. 2. Select Data and Apply Formatting: Select the target PivotTable cells, navigate to the 'Home' tab, and click 'Conditional Formatting' to set up your cross-sheet matching rules.
  3. 3. Set Rules or Run Macros: Define your matching criteria via the formatting rules menu, or press 'Alt + F11' to use the built-in VBA editor for running your custom highlighting scripts.
100% compatible with Microsoft Excel (.xlsx, .xls) and PivotTable structures.Built-in Conditional Formatting tools that easily persist upon data refresh.Advanced VBA and Macro support for automating complex data matching.Lightweight and free alternative for seamless data analysis.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my conditional formatting disappear when I refresh the PivotTable?

This happens if the formatting rule is applied to a static range of cells (like A1:D10) instead of the PivotTable's logical structure. To fix this, open the Conditional Formatting Rules Manager, edit your rule, and select the option to apply the rule to 'All cells showing [Field] values'.

Can I highlight data based on multiple conditions across different sheets?

Yes. You can use advanced Conditional Formatting with a custom formula (such as an INDEX/MATCH or COUNTIFS function referring to the secondary sheet), or write a VBA macro to loop through multiple criteria variables simultaneously.

Does WPS Spreadsheet support Excel VBA macros for PivotTables?

Yes, WPS Spreadsheet supports VBA and macros natively. You can open the VBA Editor using Alt + F11 and run your existing Excel VBA scripts to loop through worksheets and highlight PivotTable data just as you would in Microsoft Excel.