ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I exclude zero's from an average of five non-adjacent cells (https://www.excelbanter.com/excel-programming/339181-how-do-i-exclude-zeros-average-five-non-adjacent-cells.html)

MikeG

How do I exclude zero's from an average of five non-adjacent cells
 
I am trying to average the values in several non-adjacent cells in a row, and
a number of them contain zero values. How do I exclude the zero values from
the average? They are non-adjacent, or not in a specific range (e.g., they
may be in cells A2, C2, F2, J2, L2).

[email protected]

How do I exclude zero's from an average of five non-adjacent cells
 
How about:
=SUM(A2:L2)/(COUNTIF(A2:L2,"<" & 0)-COUNTBLANK(A2:L2))


Gary Keramidas[_2_]

How do I exclude zero's from an average of five non-adjacent cells
 
this may work, you didn't specilfy if there were or weren't any other
numbers in the row that you didn't want in the average.

=SUMIF(A2:N2,"0")/MAX(1,COUNTIF(A2:N2,"0"))

--


Gary


"MikeG" wrote in message
...
I am trying to average the values in several non-adjacent cells in a row,
and
a number of them contain zero values. How do I exclude the zero values
from
the average? They are non-adjacent, or not in a specific range (e.g., they
may be in cells A2, C2, F2, J2, L2).





All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com