V
Vigor
First of all, I love this group & try to lurk whenever I have a free minute
since I constantly get that "Wow! I can really USE that tip..." feeling.
I am trying to calculate the average monthly sales for each item from a
table containing one item per row, with 36 columns of monthy sales history
running backwards. If the item number itself is in column A, the sales for
Jan-04 is in column B, sales for Dec-03 is in C, Nov-03 in D, and so on
going back 36 months.
The problem is that some items were introduced less than 36 months ago
(some only a couple months ago), and hence have a zero in all the earlier
columns. I thought about find/replace zero's with "" and using the
traditional "AVERAGE" function, but due to seasonal lulls, many items also
have zero's in months LATER than months that they DO have sales, so my
average is whacky. I hit the wall trying to use 36 nested "IF" statements,
so I broke it into 6 different cells, in AL3 using:
=IF(AK3>0,AVERAGE(B3:AK3),IF(AJ3>0,AVERAGE(B3:AJ3),IF(AI3>0,AVERAGE
(B3:AI3),IF(AH3>0,AVERAGE(B3:AH3),IF(AG3>0,AVERAGE(B3:AG3),IF(AF3>0,AVERAGE
(B3:AF3),IF(AE3>0,AVERAGE(B3:AE3),AM3)))))))
and then in AM3 using:
=IF(AD3>0,AVERAGE(B3:AD3),IF(AC3>0,AVERAGE(B3:AC3),IF(AB3>0,AVERAGE
(B3:AB3),IF(AA3>0,AVERAGE(B3:AA3),IF(Z3>0,AVERAGE(B3:Z3),IF(Y3>0,AVERAGE
(B3:Y3),IF(X3>0,AVERAGE(B3:X3),AN3)))))))
etc. This works (my answer ends up in AL3, and I hide AM3:AP3), but isn't
there an easier way? At least something more direct? Some ARRAY function
perhaps?
Any help would be greatly appreciated...
Thanks
Vigor
since I constantly get that "Wow! I can really USE that tip..." feeling.
I am trying to calculate the average monthly sales for each item from a
table containing one item per row, with 36 columns of monthy sales history
running backwards. If the item number itself is in column A, the sales for
Jan-04 is in column B, sales for Dec-03 is in C, Nov-03 in D, and so on
going back 36 months.
The problem is that some items were introduced less than 36 months ago
(some only a couple months ago), and hence have a zero in all the earlier
columns. I thought about find/replace zero's with "" and using the
traditional "AVERAGE" function, but due to seasonal lulls, many items also
have zero's in months LATER than months that they DO have sales, so my
average is whacky. I hit the wall trying to use 36 nested "IF" statements,
so I broke it into 6 different cells, in AL3 using:
=IF(AK3>0,AVERAGE(B3:AK3),IF(AJ3>0,AVERAGE(B3:AJ3),IF(AI3>0,AVERAGE
(B3:AI3),IF(AH3>0,AVERAGE(B3:AH3),IF(AG3>0,AVERAGE(B3:AG3),IF(AF3>0,AVERAGE
(B3:AF3),IF(AE3>0,AVERAGE(B3:AE3),AM3)))))))
and then in AM3 using:
=IF(AD3>0,AVERAGE(B3:AD3),IF(AC3>0,AVERAGE(B3:AC3),IF(AB3>0,AVERAGE
(B3:AB3),IF(AA3>0,AVERAGE(B3:AA3),IF(Z3>0,AVERAGE(B3:Z3),IF(Y3>0,AVERAGE
(B3:Y3),IF(X3>0,AVERAGE(B3:X3),AN3)))))))
etc. This works (my answer ends up in AL3, and I hide AM3:AP3), but isn't
there an easier way? At least something more direct? Some ARRAY function
perhaps?
Any help would be greatly appreciated...
Thanks
Vigor