Average with zeroes obstacle

apwdweb

Board Regular
Joined
Aug 23, 2002
Messages
86
HI,

I have column for which i'd like to the average, however the column has about 4 numbers and the rest are zeroes. I'd like excel to give me the average of this column but ignore any zeroes as values to include.

= AVG( ???)

or maybe you know a better way. I"m open to your ideas.

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
=AVERAGE(IF(A1:A22=0,"",A1:A22)) will average non-zero values in cells A1 to A22. You need to enter it as an array formula (after you enter the formula, press ctrl+shift+enter instead of just enter).
 
Upvote 0
Perhaps something like this:

=AVERAGE(IF(N22:N28<>0,N22:N28))

Edit;
Use ctrl. shift. enter to confirm
 
Upvote 0
Easier yet is the SUBTOTAL function, with 1 as the first argument, which will ignore the zeros.

=SUBTOTAL(1,A1:A100)

will return the average of all the non-zeros in A1 thru A100.
 
Upvote 0
Hi Barry,
I tried the subtotal function and it seems to ignor blanks but includes zeros; unless the zeros are filtered out.

Barry Katcher said:
Easier yet is the SUBTOTAL function, with 1 as the first argument, which will ignore the zeros.

=SUBTOTAL(1,A1:A100)

will return the average of all the non-zeros in A1 thru A100.
 
Upvote 0
Here's my 2 cents worth,

=SUM(A1:A4)/MAX(1,COUNTIF(A1:A4,">0"))

or

=SUM(A1:A4)/MAX(1,COUNT(A1:A4)-COUNTIF(A1:A4,0))
Average0.xls
ABCD
11110.5
2r
31
4
Sheet1
 
Upvote 0
An overview of formulas...
Book1
ABCDE
10Precondition
242.06None
32#VALUE!Notextinrange
42.06None
5 1.2875Notext,noemptycellsinrange
62.72.06None
7x2.575Nonegsinrange
83.42.06None
9-1.8
100
Sheet1


[1] in C2, requires control+shift+enter...

=AVERAGE(IF(A1:A10=0,"",A1:A10))

Note. The IF bit computes: {"";4;2;"";"";2.7;"x";3.4;-1.8;""}.

[2] in C3, requires control+shift+enter...

=AVERAGE(IF(A1:A10,A1:A10))

Note. The IF bit computes: {FALSE;4;2;FALSE;#VALUE!;2.7;#VALUE!;3.4;-1.8;FALSE}.

[3] in C4, requires control+shift+enter...

=AVERAGE(IF(A1:A10<>0,A1:A10))

Note. The IF bit computes: {FALSE;4;2;FALSE;"";2.7;"x";3.4;-1.8;FALSE}.

[4] in C5

=SUM(A1:A10)/COUNTIF(A1:A10,"<>0")

[5] in C6

=SUM(A1:A10)/(COUNTIF(A1:A10,">0")+COUNTIF(A1:A10,"<0"))

[6] in C7

=SUM(A1:A10)/MAX(1,COUNTIF(A1:A10,">0"))

[7] in C8

=SUM(A1:A10)/MAX(1,COUNT(A1:A10)-COUNTIF(A1:A10,0))

See the exhibit for preconditions regarding each of the foregoing formulas.
 
Upvote 0
In addition to other fine contributions, with blanks and text entries in the midst, you may also want to try the following non-array formulation ...

=SUM(A1:A10)/SUMPRODUCT(--(A1:A10<>0)*(ISNUMBER(A1:A10)))
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,767
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top