Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 30, 60 or 90 day averages

How can I create a function to return a 30, 60, 90 date average based on a
date field. In other words, if date of a row is within the past month,
include it in the avg calculation. Thanks,

-BP-
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 30, 60 or 90 day averages


Bendleton wrote:
How can I create a function to return a 30, 60, 90 date average based on a
date field. In other words, if date of a row is within the past month,
include it in the avg calculation. Thanks,

-BP-


Hello,

If A1 holds your comparison date (i.e. TODAY()), column B your date
data and column C your data you like to average, then

=SUMPRODUCT(--(B1:B99-A1=0),--(B1:B99-A1<30),C1:C99)/SUMPRODUCT(--(B1:B99-A1=0),--(B1:B99-A1<30))

This is for 30 days rolling. If you need a special month, for example
December 2006 (enter any day of Dec 2006 into A1):
=SUMPRODUCT(--(YEAR(B1:B99)=YEAR(A1)),--(MONTH(B1:B99)=MONTH(A1)),C1:C99)/SUMPRODUCT(--(YEAR(B1:B99)=YEAR(A1)),--(MONTH(B1:B99)=MONTH(A1)))

For two or three months I would add two or three of these formulas.
Just take DATE(YEAR(A1),MONTH(A1)-1,1) instead of A1 for the month
before and DATE(YEAR(A1),MONTH(A1)-2,1) instead of A1 for two months
before A1.

Regards,
Volker

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default 30, 60 or 90 day averages

Hi

One way would be with an array formula.
With dates in column A, values to be averaged in B, place the required
number of days (30 or 60 or 90) in C1
{=AVERAGE(IF(TODAY()-A1:A10<C1,B1:B10))}

Array formulae must be committed or Edited with Control+Shift+Enter
(CSE) not just Enter.
Using CSE, Excel will insert the curly braces { } around the
formula, do not type them yourself.
Change ranges to suit.

--
Regards

Roger Govier


"Bendleton" wrote in message
...
How can I create a function to return a 30, 60, 90 date average based
on a
date field. In other words, if date of a row is within the past
month,
include it in the avg calculation. Thanks,

-BP-



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 510
Default 30, 60 or 90 day averages

Hi

=SUMIF(A:A,"=" & (TODAY()-30),B:B)/COUNTIF(A:A,"=" & (TODAY()-30))


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"Bendleton" wrote in message
...
How can I create a function to return a 30, 60, 90 date average based on a
date field. In other words, if date of a row is within the past month,
include it in the avg calculation. Thanks,

-BP-



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I figured out how to do total averages in Pivot Charts! Jason McDermott Charts and Charting in Excel 0 September 8th 06 06:21 PM
Pivot Chart--I want total average, not sum of averages Jason McDermott Charts and Charting in Excel 3 September 1st 06 06:20 PM
averages in pivot tables emcnaughton Excel Discussion (Misc queries) 1 January 6th 06 07:14 PM
Function for generating monthly & weekly averages picklet222 Excel Worksheet Functions 4 December 8th 05 09:00 PM
calculating averages Golf Averages Excel Discussion (Misc queries) 1 August 15th 05 08:25 PM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"