Calculate a 30-day moving average based on the last x number of entries and date
Assuming that Column B contains the data, try...
=AVERAGE(IF(ROW(B2:B1000)=LARGE(IF(B2:B1000,ROW(B 2:B1000)),30),IF(B2:B10
00,B2:B1000)))
....confirmed with CONTROL+SHIFT+ENTER, not just ENTER.
Hope this helps!
In article ,
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
|