Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pivot Table adding "2" to value in Report Filter

Tags:

excel

vba

I have a file with pivot tables where the filter values are updated on a monthly basis based on the last month's date. VBA code for this:

Dim SelectDate As String

SelectDate = Worksheets("Raw").Range("A3").Value
Worksheets("Main").PivotTables("PivotTable4").PivotFields("Date").CurrentPage = SelectDate

The value in cell A3 is string based on the following function:

=A1&" "&A2
For example: January 2017

Updating the pivot tables worked fine for several months, but for this month my values no longer update correctly and after doing some investigation I realized that my pivot table has created two entries in the filter for the month January 2017 and January 20172, while November 2016 went missing:

enter image description here

However, when I check my underlying data, I only have one value for each month:

June 2016
February 2016
March 2016
January 2016
November 2016
December 2016
August 2016
May 2016
October 2016
July 2016
September 2016
April 2016
January 2017
February 2017

Note that when I create an new Pivot table with the same data, the filter only shows January 2017.

Any suggestions why the filter for the existing pivot table would reflect both January 2017 and January 20172?

Thanks for your help!

like image 896
VBA Pete Avatar asked Sep 13 '25 22:09

VBA Pete


1 Answers

Here is what worked for me. This happened from what I have read elsewhere either because I added now data lines or because I did a find-and-replace. But then I changed the area of the source data in the pivot table from say

'MASTER (3)'!$A$5:$EQ$600 to 'MASTER (3)'!$A$5:$EQ$6 

and then back to

'MASTER (3)'!$A$5:$EQ$600

This resolved the problem

like image 168
Inet Kemp Avatar answered Sep 16 '25 17:09

Inet Kemp