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 Calculate a 30-day moving average based on the last x number of entries and date


Someone will probably have something better. However, here is a
possibility in the meantime.

I'm assuming Row 1 has your titles and Column A refers to your Column 1
and Column B to Column 2.

I'd put the following function in Column C: (Find the last date with a
value)
=A2 (For Cell C2)
=IF(B3<0,A3,C2) (For the rest)

I'd put the following function in Column D:
=(SUMIF($A$2:A2,"<="&C2,$B$2:B2)-SUMIF($A$2:A2,"<"&C2-29,$B$2:B2)) /
(COUNTIF($A$2:A2,"<="&C2)-COUNTIF($A$2:A2,"<"&C2-29))

If this isn't what you meant, you'll have to explain some more.

Scott

gimiv Wrote:
Hello, I have a worksheet that has all weekday dates in column 1 and
values in column 2. I want to create a 30-day moving average based on
the last (non-zero) value in the column 2. Since every month has a
different amount of days, I want it to search the date that has the
last value (since I don't get a chance to update it daily) and go back
thirsty days from that date and give an average of all the column 2
values skipping and values that are null or zero.

Any ideas?

Thanks,

Gimi



--
Maistrye
------------------------------------------------------------------------
Maistrye's Profile: http://www.excelforum.com/member.php...o&userid=36078
View this thread: http://www.excelforum.com/showthread...hreadid=558670

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
Count/Sum data with date entries. KBW Excel Worksheet Functions 6 April 5th 06 07:32 PM
Counting distinct entries based on meeting month & year criteria jennifer Excel Worksheet Functions 3 February 9th 06 01:56 PM
counting date entries by month & year Di Excel Worksheet Functions 7 August 24th 05 08:39 PM
counting specified date entries dave Excel Worksheet Functions 2 November 11th 04 09:28 AM
Count data entries and date problem Gef Excel Worksheet Functions 5 November 4th 04 02:30 PM


All times are GMT +1. The time now is 04:05 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"