How do I get an average for 5 when I need to skip cells?
Using
B5:
=SUMPRODUCT(ISNUMBER(MATCH(ROW($A$1:A5),LARGE(($A$ 1:A50)*ROW($A$1:A5),{1,2,3,4,5}),0))*$A$1:A5)/MIN(COUNT($A$1:A5),5)
After that entering formula in B5 and pressing [Ctrl][Shift][Enter]:
Select B5
EditCopy
Select B6:B100
Press [Enter]
The formulas will average up to the last 5 numeric values in A1:A100,
depending on the cell the formula is in.
B5 will look for the last 5 values in A1:A5
B10 will look for the last 5 values in A1:A10
etc
(You did say you wanted a *running* average, right?)
An alternative would be to use only this formula:
B100:
=SUMPRODUCT(ISNUMBER(MATCH(ROW($A$1:A100),LARGE(($ A$1:A1000)*ROW($A$1:A100),{1,2,3,4,5}),0))*$A$1:A 100)/MIN(COUNT($A$1:A100),5)
Again: commit that formula with [Ctrl][Shift][Enter]
That will return the average of the last 5 numeric values entered in cells
A1:A100
Does either of those help?
***********
Regards,
Ron
XL2002, WinXP-Pro
"Troy H" wrote:
That works partially, thanks. However, I need to be able to add another
cell, so that I can have 5 numbers to average. say I'm lookingat numbers in
a3 thru a10, but a9 is blank. I need to be able to average A10, A8, A7, A6,
and A5. And if posible, to throw another wrinkle, if inthe last sequence, A7
is gone along with A9, then I would need to get A4. If possible!
"Ron Coderre" wrote:
Try something like this:
For numbers, or blanks, listed in Col_A, beginning in Cell A1
B5:
=SUMPRODUCT(ISNUMBER(MATCH(ROW($A$1:A5),LARGE(($A$ 1:A50)*ROW($A$1:A5),{1,2,3,4,5}),0))*$A$1:A5)/MIN(COUNT($A$1:A5),5)
Note: Commit that array formula by holding down the [Ctrl][Shift] keys and
press [Enter].
Copy B5 and copy from B6 down as far as you need.
If there are less than 5 numbers, that formula averages as many as there are.
Does that help?
***********
Regards,
Ron
XL2002, WinXP-Pro
"Troy H" wrote:
I need to do a running average of the last five numbers, when some numbers is
a sequence can be changed. For example, for days 1 thru 6, I have numbers in
all days except for the 5th day, I need the average for days, 1,2,3,4,and 6.
|