Excel 2003 Formula Help

druane

New Member
Joined
Jul 11, 2011
Messages
2
I am using this formula =SUM(C20:I20)/COUNTIF(C20:I20,">0"). If there is a 0 in any cell that this formula is dividing by the result is a Div/0! error. Does anybody know why I am getting this error?

Thanks.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the board..

Try

=IF(COUNTIF(C20:I20,">0")=0,"",SUM(C20:I20)/COUNTIF(C20:I20,">0"))

Hope that helps.
 
Upvote 0
I am using this formula =SUM(C20:I20)/COUNTIF(C20:I20,">0"). If there is a 0 in any cell that this formula is dividing by the result is a Div/0! error. Does anybody know why I am getting this error?

Thanks.
When all numbers in C20:I20 are less than equal to 0 or C20:I20 empty/blank or the range contains at least a #DIV/0! error or all numbers are text numbers, a #DIV/0! result would follow...


To avoid #DIV/0! when appropriate to do so...

=SUM(C20:I20)/MAX(1,COUNTIF(C20:I20,">0"))

or

=IFERROR(SUM(C20:I20)/COUNTIF(C20:I20,">0"),0)

would trap the error.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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