Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Warrior Princess
 
Posts: n/a
Default Average the Last Five Cells in a Column

I have some numbers in a column and I want to take the average of the last
five. If my numbers are in A1:A10 I know I can use the AVERAGE function:
AVERAGE(A6:A10). But the problem is that some of the cells are empty.
What I want to do is take the average of the last five cells in a column, so
long as those cells have numbers in them. So if cell A7, for example, is
empty, I would average A5:A10. If A7 and A8 are empty, I would average
A4:A10. Is there any way that this is possible?


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Here is a solution that Peo Sjoblom posted last year

=AVERAGE(A65535:INDEX(A1:A65535,SUMPRODUCT(LARGE(R OW(1:65535)*(A1:A65535<""
),C1))))

C1 is a cell containing the number of cells to average, 5 in your case

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Warrior Princess" wrote in message
...
I have some numbers in a column and I want to take the average of the last
five. If my numbers are in A1:A10 I know I can use the AVERAGE function:
AVERAGE(A6:A10). But the problem is that some of the cells are empty.
What I want to do is take the average of the last five cells in a column,

so
long as those cells have numbers in them. So if cell A7, for example, is
empty, I would average A5:A10. If A7 and A8 are empty, I would average
A4:A10. Is there any way that this is possible?




  #3   Report Post  
Warrior Princess
 
Posts: n/a
Default

Thank you!

"Bob Phillips" wrote in message
...
Here is a solution that Peo Sjoblom posted last year


=AVERAGE(A65535:INDEX(A1:A65535,SUMPRODUCT(LARGE(R OW(1:65535)*(A1:A65535<""
),C1))))

C1 is a cell containing the number of cells to average, 5 in your case

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Warrior Princess" wrote in message
...
I have some numbers in a column and I want to take the average of the

last
five. If my numbers are in A1:A10 I know I can use the AVERAGE function:
AVERAGE(A6:A10). But the problem is that some of the cells are empty.
What I want to do is take the average of the last five cells in a

column,
so
long as those cells have numbers in them. So if cell A7, for example, is
empty, I would average A5:A10. If A7 and A8 are empty, I would average
A4:A10. Is there any way that this is possible?






  #4   Report Post  
Jason Morin
 
Posts: n/a
Default

One way:

=AVERAGE(OFFSET(A10,,,LARGE(IF(A1:A10<"",ROW(1:10 )),5)-
ROWS(A1:A10)-1))

While it works fine, the only downside is that OFFSET is
a volatile function. INDEX should be the preferred
function.

HTH
Jason
Atlanta, GA


-----Original Message-----
I have some numbers in a column and I want to take the

average of the last
five. If my numbers are in A1:A10 I know I can use the

AVERAGE function:
AVERAGE(A6:A10). But the problem is that some of the

cells are empty.
What I want to do is take the average of the last five

cells in a column, so
long as those cells have numbers in them. So if cell A7,

for example, is
empty, I would average A5:A10. If A7 and A8 are empty, I

would average
A4:A10. Is there any way that this is possible?


.

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
How do I pivot a range of cells, i.e. from column to row? Ernst Excel Discussion (Misc queries) 2 March 7th 05 04:53 PM
In a column of text data, how do I delete random cells that have . Minivann Excel Discussion (Misc queries) 2 January 26th 05 09:07 PM
Copy cells to another column with VBA Joe E via OfficeKB.com Excel Discussion (Misc queries) 1 January 26th 05 04:32 PM
Help adding text values Texas-DC_271 Excel Worksheet Functions 7 January 15th 05 11:14 PM
how do I find an average number of specific words in a column cashgrfx New Users to Excel 7 January 6th 05 04:44 PM


All times are GMT +1. The time now is 07:37 AM.

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

About Us

"It's about Microsoft Excel"