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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rolling 12 in a Pivot table

Status
Not open for further replies.

thefox149

Technical User
Nov 22, 2004
158
AU
I am putting together a pivot table and rather then just summarizing the data for each month I would like each months results to be a rolling 12 eg

RTM Amount
Jun 05 1250 this amount is the sum of(Jul 04 to Jun 05)
Jul 05 1100 this amount is the sum of(Aug 04 to Jul 05)
Aug 05 1200 this amount is the sum of(Sep 04 to Aug 05)
etc

My cat's name is sprinkles
-Ralph Wigam
 
Only way I can think of is by adding another field to your source data that does just that, eg assuming your Amount data was in col C and your date value was in column B, then in a column at the end of your data, call the header Amt2 or something and use the following:-

=SUMPRODUCT(--($B$2:$B$2000>DATE(YEAR(B2)-1,MONTH(B2),DAY(B2))),--($B$2:$B$2000<=B2),$C$2:$C$2000)

Then change that field to MAX instead of SUM using Field Settings.

Regards
Ken............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
thanks ken funnily enough i did solve it with sumproduct ...

My cat's name is sprinkles
-Ralph Wigam
 

What does the "--" do in the formula below?

=SUMPRODUCT(--($B$2:$B$2000>DATE(YEAR(B2)-1,MONTH(B2),DAY(B2))),--($B$2:$B$2000<=B2),$C$2:$C$2000)


 
this shaved a minute of a 5 minute complicated sumproduct I had....not bad have a star

My cat's name is sprinkles
-Ralph Wigam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top