S
SteveMac
How can I get the average of all numbers except zeros in a
column?
column?
=AVERAGE(IF(A1:A20,A1:A20))
still array entered though, and will ignore blanks and 0s
-----Original Message-----
I like to keep it just for self documenting purposes.
11/03/2004
--
Dave Peterson
(e-mail address removed)
.
Ken Wright wrote
Always interested in new ways to adapt my existing formulae, I tried
this and got #DIV/0! if array entered. Not array entered worked.
You can't average a set of empty cells as the count is 0, hence the
#DIV/0
You get the same result using the <>0 in there as well
When you say worked, I assume you mean because you didn't get #DIV/0,
hence it actually didn't work, as that is what it should have
returned. Try a straight =AVERAGE(Range) on an empty set and you will
get #DIV/0
Actually I got a result of 0 when not array entered, which surprised me.
But if you don't array enter and only use Average, then the 0s get
included in the equivalent of your denominator, and the OPs question
was how to exclude them from this, eg:-
A
1 20
2 15
3 10
4 0
5 10
1) =AVERAGE(A1:A5) = 11
2) =AVERAGE(IF(A1:A5,A1:A5)) entered normally will give 11
3) =AVERAGE(IF(A1:A5,A1:A5)) array entered will give 13.75
Both 1 and 2 include the 0 in A4 in the average, and the OP
specifically wants to exclude this value, hence the average of the
remaining values should be 13.75, as given *only* by the array entered
formula.
You could check to see if there are any numbers <> 0 to average first.
=IF(COUNTIF(A1:A20,"<>0")=0,"No nice numbers to average",
AVERAGE(IF(A1:A20<>0,A1:A20)))