4

I have 4 pivot charts that rely on data that is refreshed from a connection.

When I click refresh all I lose all the formatting I set up (colours/borders/line and bar and 2nd axis choices)

  • I have already unchecked Properties Follow Chart Data Point for Current Workbook.
  • I have also tried Right Click on Data > Refresh per data table but I get the same issue.
  • Preserve cell formatting on update is ticked for all charts.
  • Invert if negative option ticked/unticked doesn't make a difference
  • Preserve cell formatting on update I have tried unticking, then ok, then right click options and re tick, still didnt work..
  • I have saved the chart format as a template then after refresh re applied but formatting is still lost.

Version:

Excel 2016 MSO (16.0.4738.1000) 32-bit

enter image description here

6
  • Is Making Regular Charts from Pivot Tables a useful solution?
    – harrymc
    Nov 5, 2018 at 11:43
  • @harrymc Thank you for your input, unfortunately this would only benefit not having pivot tables and a pivot chart from data and just the chart, but this is not the issue.
    – Matt
    Nov 6, 2018 at 10:10
  • I found some report that says that it helps to open the pivot table options and unticking "preserve formatting", closing the option box, then reopening it and selecting again "preserve formatting" (link). There is also the complicated Solution #2 from this article.
    – harrymc
    Nov 6, 2018 at 10:22
  • @harrymc Let me try that now
    – Matt
    Nov 6, 2018 at 10:33
  • The tick and untick didnt work
    – Matt
    Nov 6, 2018 at 12:18

9 Answers 9

2

@Matt - same as you, none of the solutions above worked for me either. What was more frustrating was that I had two Pivot Chart/Tables in the same file, both linked to the same Power Pivot data model, one would maintain its custom formatting but the other would not. Thus I knew it was very unlikely related to my version of excel or a specific bug.

The article linked by harrymc contains the key clue to resolving this, but not using the workaround - it's the XML. I was at the point of comparing the XML for the two Pivot Charts but then thought there may be a formatting hierarchy at work here.

My solution:

  1. Delete any dependent Pivot Chart(s) (You're starting from scratch)
  2. Delete ALL slicers and remove ALL filters from the Pivot Table.
  3. Ensure that 'Preserve cell formatting on update' is ticked (this won't solve the issue directly but seems important)
  4. Add a new Pivot Chart but DO NOT filter or slice the data in any way regardless of how bad the chart may look at this stage.
  5. Apply the custom formatting.
  6. Save the file (a user in another forum suggested exiting and restarting Excel - which I did out of desperation!)
  7. Now add in the filters/slicers to create the desired chart.

I was then able to refresh/slice/filter the data and the custom chart formats were all preserved.

2
  • 1
    Thanks for the extra information, I ended up just using a BI tool.
    – Matt
    Jan 4, 2019 at 13:18
  • I just wanted to add the part in parenthesis in step six were crucial for me. These steps did not work without the step of reopening Excel after saving, but it worked wonderfully with that step. This is in Excel 2016.
    – Daniel
    Jun 28, 2021 at 18:54
2

The best solution to this recurring error is : Select the whole pivot table --> go to Analyze option on the ribbon bar --> Actions section --> click on Select --> entire pivot Now perform whatever formatting you want and save the sheet, once done use the refresh. This worked absolutely correct for me .

Hope it helps.

2

What worked for me was clicking on 'Value Field Settings' on the specific field, 'Number Format' in that popup, and then setting the formatting there. After refreshing it, it kept the formatting.

2

Don't use the Format Painter to paint from another table. Set up one header how you want in the new pivot table, then format paint it across the other headers.

tldr: format painter (for some reason) doesn't work across pivot tables linked to a power pivot model.

1
  • Thanks, I encountered this same issue with format painter, was driving me insane. Format painter does NOT work on pivot tables for retaining the format. Aug 4, 2021 at 15:20
1

To keep the formatting when you refresh your pivot table, do with following steps:

  1. Select any cell in your pivot table, and right click.

  2. Then choose PivotTable Options from the context menu.

  3. In the PivotTable Options dialog box, click Layout & Format tab.
  4. Then check Preserve cell formatting on update item under the Format section.
  5. Finish with OK to close.

Now, whenever you format your Pivot Table and refresh it, the formatting will not be disappeared any more.

Edited 1:

You may try these :

Invert if negative option must be checked for Pivot Chart Options.

Or you may write this VBA Code in Immediate Window.

Worksheets("Sheet1").ChartObjects("Chart 1").Chart.SeriesCollection(1).InvertIfNegative = True

Note: Sheet, Chart & Series number are editable.

Edited 2

Another possibility is,,

  1. Select the Plot Area, Right Click and select command Save as Template".

Whenever you loose the Chart Format, reach to Excel, File Select the graph.

  1. Right Click and select Change Chart Type.

  2. Select the Template from the Chart type poping up Menu.

You find all those lost Formats on the Selected Chart applied previously.

N.B.

Above shown process can be implemented through VBA (Macro) on a Chart or an all Charts also.

11
  • Its a pivot chart, not a pivot table, nevertheless this is ticked on everything.
    – Matt
    Nov 6, 2018 at 10:05
  • @Matt,, Preserve formatting on update setting somewhat resolves the issue, as that is what I see as well in my tests. Nov 6, 2018 at 10:54
  • @Matt,, invert if negative option must be checked in a pivot chart. Or write this VBA Code in Immediate Window. Worksheets("Sheet1").ChartObjects("Chart 1").Chart.SeriesCollection(1).InvertIfNegative = True Nov 6, 2018 at 11:05
  • @Matt,, check the post now I've edited the Answer so far will work !! Nov 6, 2018 at 11:34
  • Invert if negative option doesn't work
    – Matt
    Nov 6, 2018 at 11:36
1

The article Pivot Chart Formatting Changes When Filtered treats the subject in depth.

It explains that Excel actually stores formatting data in a cache with all the other chart properties. This means that it remembers the exact formatting. When the data is refreshed, Excel invalidates this cache, so that the default formatting for the chart is applied.

It offers a solution where a new area on the worksheet is created that contains a replica of the PivotTable, containing formulas that reference the PivotTable, using either the direct cell references like (=C9) or the GETPIVOTDATA() function to point to the PivotTable. The GETPIVOTDATA function is preferable for the display of a subset of the PivotTable data in the chart.

This is done in two steps.

Step 1

The first step is to recreate the PivotTable data by creating formulas that reference the pivot. This can be done in cell adjacent to your PivotTable or on a separate worksheet. Just remember to leave enough blank rows/columns between your PivotTable and formula based table in case your PivotTable expands when filters are applied/removed.

enter image description here

Step 2

Step two is to create a regular chart using the new formula driven table as the source of the chart. When the PivotTable is filtered or sliced, the formulas will automatically be updated and display the new numbers from the PivotTable. The chart will also be updated and display the new data.

enter image description here

Conclusion

The article concludes with :

Adding slicers to your PivotCharts and PivotTables is a great way to make your presentation interactive. PivotCharts allow you to link your chart to a data source so they can be refreshed dynamically with little maintenance. However, PivotCharts display some odd behavior when filtering charts with custom formatting. Understanding this behavior and planning for it at design time will save you time and frustration.

An example presentation can be downloaded from
PivotChart Formatting Changes On Filter Slicer.xlsx.

The author also recommends the article Dynamic Chart using Pivot Table and VBA with the approach of using VBA to create dynamic charts using a more advanced approach (too long to include here).

3
  • Cant recreate the combo chart stacked bar and line i have with this method
    – Matt
    Nov 7, 2018 at 11:31
  • Have a look at the example presentation.
    – harrymc
    Nov 7, 2018 at 20:24
  • Yeh i can create a line/bar chart, but not a combo
    – Matt
    Nov 8, 2018 at 10:40
1

I just found a solution to the issue of the Pivot Table changing formatting even if "preserve formatting on update" is selected.

I got rid of all subtotals, then selected the cells I wanted to format, formatted them, then put the subtotals back in. Voilà ça marche. Will see if it continues to do so.

1

I had the same issue. I changed the values in my pivot table and lost the "Sticky" formatting of my headers. I tried everything mentioned above except for trying to recreate or start from scratch with no success. I had all they typical settings mentioned above already set, but nothing would "Stick".

What finally worked for me:

I right clicked each cell I wanted to format and used the popup options that were available to format the cell shading and font. I still needed to use some of the more technical options from the ribbon, but I continued to make my first change to the cell by changing the cell shading from the popup option first. I made sure to save before I clicked refresh, but they finally stuck using this method.

0

I experienced a similar problem with Pivot Tables. When I filtered data using a Slicer the formatting was erased, but only in some sections.

  1. Keep the "Preserve cell formatting on update" box checked.
  2. In the "Analyze" ribbon tab, open "Filter Connections".
  3. Uncheck all filters
  4. Apply formatting
  5. Reopen "Filter Connections"
  6. Apply each Splicer and save each one at a time. This sounds odd, but I lost the formatting when I attempted to apply all at once.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .