How to Apply Conditional Formatting to Expanding Pivot Tables
Question details
The user wants to apply a conditional formatting rule to a pivot table to highlight specific values (e.g., On Hand + On Order < Remaining To Ship) that dynamically adjusts as the pivot table size changes.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Managing inventory data in a pivot table that updates and expands over time, requiring dynamic cell highlighting.
- Observed behavior
- The user needs the formatting rules to remain accurate and automatically cover all relevant cells even when new rows or columns are added to the pivot table.
Ensure your pivot table is fully set up with the required fields (such as On Hand, On Order, and Remaining To Ship) and take note of the starting cell references for your data columns.
Apply a Relative Formula Rule to the Pivot Table
Create a custom conditional formatting formula using relative references so the highlighting adapts automatically to new rows in the pivot table.
When applying conditional formatting to dynamic ranges like pivot tables, using a formula with mixed references (locking the column but leaving the row relative) ensures the logic holds true as the table expands.
Highlight the first value cell or the entire value area of your pivot table where you want the formatting to appear.
Navigate to the Home tab on the ribbon, click on 'Conditional Formatting', and select 'New Rule'.
In the dialog box, select 'Use a formula to determine which cells to format'.
Type your logical formula using relative row references and absolute column references. For example, enter `=AND($B5+$C5<$D5)` assuming column B is On Hand, C is On Order, and D is Remaining To Ship.
Click 'Format' to choose your highlight color and click 'OK'. Next to the formatted cell, click the formatting options icon that appears and select 'All cells showing [Field] values' to lock the rule to the pivot table structure.

Use WPS Spreadsheet for Advanced Pivot Table Formatting
WPS Spreadsheet provides powerful pivot table tools and robust conditional formatting options, allowing you to easily analyze dynamic datasets and highlight critical metrics without complex workarounds.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your raw data.
- 2. Insert a Pivot Table: Select your data range, go to the Insert tab, and click 'PivotTable'.
- 3. Configure your fields: Drag and drop your required fields into the Rows, Columns, and Values areas to build your report.
- 4. Create a new formatting rule: Select the data values, go to Home > Conditional Formatting > New Rule, and choose the formula method.
- 5. Apply and analyze: Enter your relative formula, set the format color, and apply the rule to the pivot table fields for dynamic tracking.

Frequently Asked Questions
Why does my conditional formatting disappear when I refresh the pivot table?
This usually happens if the formatting is applied to fixed cell ranges (e.g., A1:D10) instead of the pivot table's internal structure. When creating the rule, make sure to select the option to apply it to 'All cells showing [Value] values' so it anchors to the data field itself.
Can I use data bars or color scales on a pivot table?
Yes, you can apply data bars, color scales, and icon sets to pivot tables. After applying the preset rule to a single cell, click the Formatting Options icon that appears next to it and choose to apply the rule to all cells showing that specific value field.
How do I reference pivot table grand totals in a conditional formatting rule?
Grand totals and subtotals are treated separately from regular row data in pivot tables. You generally need to create a dedicated conditional formatting rule specifically for the Subtotal or Grand Total rows, or exclude them from your main rule to prevent incorrect highlighting.




