average function for a series

  • Thread starter Thread starter bumpo
  • Start date Start date
B

bumpo

Using Excel 2000.
I'm looking for a function that will look at a database , lets say, A1:A100
and take the average of the last 5 cells, A96:A100. When I add data to A101,
I want that same function to average A97:A101.
 
Try

=AVERAGE(OFFSET(A1,MATCH(9.99999999999999E+307,A:A)-5,,5))

confirmed with CTRL+SHIFT+ENTER
 
All the replies were great and all worked. I also need to average the last 10
cells and the last 15. Not sure what to change. In Daddy's formula, I changed
to -10,,10. but I get a #REF! until my data base has data in all 10 cells.
If the data base is only 9 or less cells, I would like the function to
reflect the ave. of those. Is this possible?
Thanks in advance.
 
Try this:

=IF(COUNT(A:A),AVERAGE(A65536:INDEX(A:A,MAX(1,(COUNT(A:A)-n)+1))),"no data")

Where n = the number of cells you want to average: 5, 10, 15, whatever. If
there is less than n numbers it will average whatever's available.

I'm assuming the data is in a contiguous block (no empty cells or TEXT
entries within the range.)
 
Biff
Thanks for your response. This is huge help. The way I get what seems to be
the correct results is to use n = (the number of cells to average) -1. eg.
5-1, 10-1, 15-1
Does that sound right?
Thanks again,
 
Post the exact formula you're using. The adjustment you made is probably
based on a different range starting point.
 
Ok, that's it. In your original post you said the range was A1:An. So I used
that as the basis of my formula.
 

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