PC Review


Reply
Thread Tools Rate Thread

Cycling Through Pivot Field

 
 
=?Utf-8?B?VC4gSmVua2lucw==?=
Guest
Posts: n/a
 
      9th Mar 2007
I want to create a macro that cycles through a Year-Month field in a pivot
table, allowing me to easily update a chart for different years and months.
In other words, I'd like to be able to click an up or down button to update a
pivot table and chart to show a set of data for different year-months. I'm
also considering just a single "start" button to cycle through all
year-months at one time.

Can anyone offer suggestions on how to do this?

Thanks,
Todd

 
Reply With Quote
 
 
 
 
Greg Glynn
Guest
Posts: n/a
 
      9th Mar 2007
Hi Todd,

There's a better way. I've struck this problem regularly.

The Pivot table will provide you with a categorised datatable, so what
you need is a way to get the data out of it on a rolling basis.
Here's what I do.

I have three sheets: (1) The Base Data, (2) the Pivot Table and (3)
the Charting Table

Assign a cell (A1) on the Charting Table for the "Reporting Month" or
"Week Ending" or what ever your reporting period is. Create the
charting table so that a simple list of dates is set-up one under
another, and all relative to the one above

ie:
B3 = A1
B4 = B3+7
B5 = B4+7
B6 = B5+7

etc..

Then the C3 Cell looks into the Pivot Table to extract the Value for
date value in B3.
The =GETPIVOTDATA() formula looks complex, but you can bypass it's
complexity by simply keying in '=' in C3 then going to the pivot table
and selecting the value you want to extract. Once you've got it,
change the formula so that it looking in to B3 for it's date. Then
copy this formula down the charting data.

Viola! You've created a rolling report (and chart) that automatically
updates itself based on the value of A1.

To protect against errors (like #REF! errors) in the GETPIVOTDATA
formula, I use:
=IF(ISERROR(GETPIVOTDATA("Hours",'PVT-ITIL Breakdown'!$A$3,"Group",B
$3,"ProductName",B$24,"Activity",C3)),"",GETPIVOTDATA("Hours",'PVT-
ITIL Breakdown'!$A$3,"Group",B$3,"ProductName",B$24,"Activity",C3)) -
But there may be a nicer way than this.

Hope this is not too confusing.

Greg

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change a pivot field based on another pivot field Basil Microsoft Excel Programming 10 16th Feb 2009 02:38 PM
All Pivot table include different pivot field to save as individualworkbook beancurdjelly2003@yahoo.com.hk Microsoft Excel Programming 5 14th May 2008 02:43 PM
[address1].column(1): field info disappears when cycling records =?Utf-8?B?c2N1YmFkaXZlcg==?= Microsoft Access Form Coding 2 16th Nov 2006 06:01 PM
pivot tables: changing 'sum of' to 'average of' & cycling through pages Tim Microsoft Excel Programming 4 10th Apr 2006 10:49 PM
Pivot Table Cycling Through Page Fields Automatically =?Utf-8?B?bnJlaG1hbg==?= Microsoft Excel Misc 14 13th Oct 2005 07:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:20 AM.