Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to select dates from a pivot table

Status
Not open for further replies.

adgesap

Technical User
Mar 11, 2005
10
GB
I need to select items from a pivot table based on dates. The pivot is based on a list of employees who have left, and I have grouped the leaving dates by month, using the =Date() function, ie:
Date Month
15/03/2008 01/03/2008
26/04/2008 01/04/2008
02/03/2008 01/03/2008
I use Month Column to group records in my pivot table, and I want to select certain groups based on that Month. Ideally, I want the macro to select all records where the month starts with the month before the month that it's run (if it's run in August, it should start with July) and then select 12 month's of historical information: July, June, May,...
I'm sure that a looped array will take care of this, but it's translating dates to text that's causing me a headache.
 




Hi,

I'd suggest using the SOURCE DATA to gather this kind of data, rather that a REPORT, which is what a PivotTable is.

1. you could run another PivotTable using the save source data

2. With the SUMPRODUCT function, you can specify multiple criteria like for the dates. If you use first of the month dates (enter Jan 2008, for instance and drag down), you can use >= the date and < the next date.

3. use MS Query to summarize the data.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top