Ignore zero in subtotal formula

S

Sarah (OGI)

I have the following formula whice averages the cells in column G. However,
some of those cells show a zero, which I would like to ignore. What would I
need to add to my formula to accommodate this?

=SUBTOTAL(1,G:G)

Thanks in advance
 
R

Rachel Garrett

Try this:

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

This sums the entire column, but only divides it by the non-zero
cells, thus giving a true average.

Thanks,
Rachel Garrett
 
R

RinTinTin

Sarah,

You can ignore the count of zeros with the array formula
COUNT(IF(array>0,array)). Use that as your denominator and the SUM function
as the numerator. You can do the same thing by using Subtotal functions, one
for the numerator and one for the denominator. Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top