Pivot Table ~~Weird~~

Parra

Well-known Member
Joined
Feb 21, 2002
Messages
752
Monthly I create reports based on Pivot Tables.

I have a sheet where I update the Pivot Table data and then I just refresh the tables to update the numbers. I delete the old data and replace it with new data.

The problem is that when I click on the drop down box to drill now on information. The Old data appears and not the new one. Even though the old data has been deleted????

Does anyone know how to get around this?

Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
It seems to me that the Old Data is incorporated into your dropdown box BEFORE it is eliminated. Save your Excel file, close it and re-open it. i believe that now the New Data will now be properly loaded into your dropdown box.

As to how to avoid this annoying result totally, somebody else will have to help you.
 
Upvote 0
I asked this question a while ago, and cannot find the thread. Here is the code I used:

'THIS MACRO ELIMINATES PHANTOM DATA
Sub Borrar_PivotItems()


Dim wksH As Worksheet
Dim ptP As PivotTable
Dim pfP As PivotField
Dim piP As PivotItem
Dim i As Integer

On Error Resume Next

For i = 1 To 2
For Each wksH In ActiveWorkbook.Worksheets
For Each ptP In wksH.PivotTables
For Each pfP In ptP.PivotFields
For Each piP In pfP.PivotItems
piP.Delete
Next
Next
ptP.RefreshTable
Next
Next
Next
Set piP = Nothing
Set pfP = Nothing
Set ptP = Nothing
Set wksH = Nothing
End Sub


Calicat
 
Upvote 0
Note that a solution without code that usually works is to remove everything from the PT and refresh the empty pivot table, then add the items back (often you only need to remove the field that has the old data which is now missing).

See:
http://www.contextures.com/xlpivot04.html
 
Upvote 0
More help... This macro worked wonderfully on several pivot tables and table fields but doesn't seem to be able to clean up the following month info where Excel thinks there was a version 1 of the month so it numbers some as 2 i.e. Jun2, Oct2, etc.

Year Month Total
2011 Jun2 154
Jul2 392
Aug2 260
Sep2 222
Oct2 261
Nov 296
Dec2 267
2012 Jan 230
Feb 176
Mar 196
Apr 226
May 239
 
Upvote 0

Forum statistics

Threads
1,221,322
Messages
6,159,228
Members
451,547
Latest member
loop98

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top