Division by Zero Error

K

Ken D.

I am using this formula to average the values in cells F49:J49 if the value
is greater than zero.

=SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0")

When all values are 0, I'm getting the division by zero error.

Just a little help please...
 
B

bpeltzer

You could put the entire average calculation inside an if that detects a 0
denominator and avoids the division in such cases:
=if(countif(F49:j49,">0")=0, 0, your average calculation)
 
V

Vito

Do you just want a blank cell if all cells are zero?

If so,

=IF(SUM(F49:J49)=0,"",SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0"))
 
A

Ashish Mathur

Hi,

You may use the following array formula (Ctrl+Shift+Enter):

=average(if((F49:J49>0),F49:J49))

Regards,

Ashish Mathur
 
V

Vito

Ashish said:
Hi,

You may use the following array formula (Ctrl+Shift+Enter):

=average(if((F49:J49>0),F49:J49))

Regards,

Ashish Mathur

That stills gets you the #DIV/0 error message, which the OP was getting
originally, when all cells in the range are 0
 

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