View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default Pivot table formulas

Hi Tim

you can use Herbert's elegant solution in earlier versions of Excel.
With the source data set up as he has shown, (but not as a table), then the
formulae would become
D5
=DATE(YEAR(Sheet1!$B$5:$B$119),MONTH(Sheet1!$B$5:$ B$119),1)
E5
=COUNTIFS(Sheet1!$D$5:$D$119,Sheet1!$D$5:$D$119)
F5
=SUMPRODUCT((Sheet1!$C$5:$C$119)*
(Sheet1!$D$5:$D$119=EDATE(Sheet1!$D5,{0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11})))
/Sheet1!$E$5:$E$119

Clearly these formulae are using fixed ranges, the size of Herbert's source
data.
You would be better creating Dynamic Named ranges
InsertnameDefine
Name lrow
Refers to =COUNTA(Sheet1!$B:$B)
Name DDate
Refers to =Sheet1!$B$5:INDEX(Sheet1!$B:$B,lrow)
Name Amt
Refers to =Sheet1!$C$5:INDEX(Sheet1!$C:$C,lrow)

Repeat for the other column names, and substitute the names in place of the
fixed ranges in the formulae.
(I have written some code for generating dynamic named ranges for each used
column in a workbook, which can be downloaded from
http://www.contextures.com/xlNames03.html)

Be aware, that you also need to use ToolsAddinsAnalysis Toolpak, in order
to have the EDATE function available to you.

--
Regards
Roger Govier

"Tim Wheeler" wrote in message
...
Dear Hernert

Thank you for your help. I assume that this functionality is only
available
with Excel 2007?

Kind regards
Tim

"Herbert Seidenberg" wrote:

Excel 2007 Pivot Table
Moving Annual Total, by month.
A Bear.
http://www.mediafire.com/file/yay5yotdjmo/04_21_09.xlsx