View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rda rda is offline
external usenet poster
 
Posts: 4
Default Need help with range value calculation

That was the simple solution and it would work if all cells had a value. But
in this case what I need to do is determine the last 4 cells that have a
value and divide it by 4. For example: Cells A1:C1 have values, cells D1:E1
do not, cells F1:G1 have values. The results calculation for B4 would be
A1(34)+B1(43)/2, C4 would be A1(34)+B1(43)+C1(30)/3, D4 and E4 would both be
the same as C4 since no value existed in D1 or E1, F4 would be
A1(34)+B1(43)+C1(30)+F1(36)/4, G4 would be B1(43)+C1(30)+F1(36)+G1(42)/4,
...., and J4 would be F1(36)+G1(42)+I1(44)+J1(32).

Any ideas how to accomplish this with a formula calculation?

Thanks in advance,
rda

"Castell" wrote:

Remove the dollar signs from the formula in cell D4 and copy this formula
across to all cells to the right of D4.


"rda" wrote in message
...
I am looking for a formula that would allow me to calculate a maximum of
the
last 4 numeric values in a row divided by their count. For example:

A B C D E F G H I J
1 34 43 30 36 42 44 32
2 82 22 14
3 22 32 44 44 32 12 44 18 22

With the values in the cells displayed I would need a formula to get the
results in the following cells:

4 34 38 35 35 35 35 37 37 38 38
5 82 52 39 39 39 39
6 22 27 32 35 38 33 33 26 24

The results will be used in another worksheet for additional calculations
as
needed.

The formula I came up with are as follows:
A4: =A1
B4: =IF(COUNT($A$1:B1)0,INT(SUM($A$1:B1)/COUNT($A$1:B1)),"")
C4: =IF(COUNT($A$1:C1)0,INT(SUM($A$1:C1)/COUNT($A$1:C1)),"")
D4: =IF(COUNT($A$1:D1)0,INT(SUM($A$1:D1)/COUNT($A$1:D1)),"")

This is where I'm stuck. If a value existed in D1 and a value in E1 then
the calculation should not include A1. In this instance there is no value
in
either and E4 will have the same result as D4. Once we get to G1 then A1
must be dropped but the remaining need to be summed and divided by 4 with
the
results in G4.

I hope I've explained my problem well and someone can come up with a
simple
solution.

Thanks,
RDA