Different length moving averages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello;

I have several thousand data points listed consecutively in column A of my
spreadsheet. In column B, I use the AVERAGE argument to create a specific
length moving average of all points. I am running a "what-if" study to find
the optimum length moving average. Is there a way to write a macro, I so I
can just supply the length of desired moving average in the top cell of
column B, and I don't have to rewrite the AVERAGE argument each time, and cut
and paste it in every cell?

Thanks.
 
In B2:

=AVERAGE(OFFSET(A2,-$B$1+1,0,$B$1,1))

and copy it down.

The formula will return an error until you have sufficient cells for the first
average, i.e. if you specify 10 in cell B1, the formulas in B2:B9 will return
errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top