6

When using PivotTables in Excel, it's often useful to overtype certain PivotTable labels with new names.

If you have a long list of items you've relabelled, it can be easy to lose track of what the original labels were. The only method I've found to restore the original labels is to go into the source data, dig all the original labels out, and change the PivotTable label back one-at-a-time.

I have over 50 renamed labels, this is tedious.

Is there any way to clear all renamed PivotTable labels for a given field, in one fell swoop?

Edit: I'm using Excel 2010, but interested in any methods available in later versions as well.

  • You have not mentioned which version of Excel you are using – Firee Mar 27 '14 at 11:52
10
  1. Rename the column header/name in the source
  2. Refresh the pivot. This will drop all forced labels and drop field from the pivot.
  3. Rename the column name back to what it was
  4. Refresh pivot again
  5. Add the field back into your pivot.
| improve this answer | |
  • 2
    If I'm using a pivot table that connects through an Analysis Services cube (i.e. I don't have direct access to the source data columns), is there an alternative method? – psyk0 Oct 31 '14 at 10:44
  • 1
    @psyk0, there doesn't seem to be an easy answer for this with SSAS... more at stackoverflow.com/questions/998185/… – Sean Summers Dec 29 '14 at 19:44
2

This macro will remove all captions from the row labels and column labels in all pivottables in a workbook. This will NOT work with PowerPivot Tables.

Sub FixPivotItemCaptions()
Dim pi As PivotItem
Dim pt As PivotTable
Dim wb As Workbook
Dim ws As Worksheet
Dim pf As PivotField

Set wb = ActiveWorkbook

Application.ScreenUpdating = False
For Each ws In wb.Worksheets
    For Each pt In ws.PivotTables
        For Each pf In pt.PivotFields
            For Each pi In pf.PivotItems
                pi.Caption = pi.SourceName
            Next
        Next
    Next
Next
Application.ScreenUpdating = True
End Sub
| improve this answer | |
  • For me this ended up replacing the labels with their MDX representation ([Dimension name].[...].&[999999]) and throwing an error for a SSAS-backed pivot table in Excel 2016. – Nickolay Apr 12 '18 at 10:01
0

If the column in question is already in several Pivots and there is some effort or troubles to re-add the column or you fear to destroy some layouts for example - then I propose the following easy way:

  • Rightclick anywhere in the pivot, select "Pivot Table Table Options", select the "Data" Tab and Change "Number of items to retain per Field" to none.
  • refresh the pivot

And there we go, old field label item ("aliases") are forgotten. You possibly want to rename the data aliaes back to where you want them, and possibly undo the "Number of items to retain per Field" to automatic.

| improve this answer | |
  • I tried this and it didn't work. Is this perhaps because you are using an external data source? With a regular worksheet as the datasource it didn't seem to take. – rohrl77 Feb 14 at 9:25
-1

you can allow excel to forget items it hasn't seen in the most recent update, then load a dummy table (select top 1 from ).

Some variant on this will work for all versions of excel.

http://www.contextures.com/xlPivot04.html

| improve this answer | |
  • The link talks about forgetting items no longer in the data source... that's not what my question refers to. I was asking about items that do exist in the data, but have been renamed in the pivot table. – Andi Mohr Apr 8 '15 at 8:26
  • i agree, that's why i also said to load a dummy table with only 1 row, -- this would move all the custom named items into the set of data to be cleared from the cache, so that when you switch back to the normal table, it's forgotten all your renaming. – Andrew Hill Apr 8 '15 at 22:35
  • Ah I see - actually remove all the data from the data source but retain the headings. That's probably overkill when I only want to drop all the renamed labels from a single column (and retain renamed labels in other columns) Thanks for the tip - will be useful in certain situations. – Andi Mohr Apr 9 '15 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.