countifs formula returns #div/0 error which cause a sum formula to return the same error

geoffrey22

New Member
Joined
Jan 26, 2015
Messages
1
I am using excel 2010 with windows 7

Each teacher has formulas similar to this: =
(COUNTIFS($B5:$B30,"x",D5:D30,">=70"))/(COUNTIFS($B5:$B30,"x",D5:D30,">=0"))*100
This formula is doing what it is supposed to do (identify students in a certain category and if they scored a 70 or higher).
The problem occurs when the teacher doesn't have any students in a specific category which then creates a divisor of 0, hence the error message.

1) How can I set this up so it returns N/A in the cell instead of #div/0

A second problem is that the data from each teacher's worksheet is pulled into another worksheet to create a summary page. The following is an example:
Smith 100
Jones 36
Max #div/0
Dill #div/0

Then when I use the following forumulas, I get #div/0 error message again.
=AVERAGE(Smit!hD39+Jones!D39+Max!D39+Dill!D39)/400
and
=SUM(B13:B16)/4

2) How can I get these two formulas to ignore the #div/0 message and make the calclulations?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
You should check for the #DIV/0 error before attempting the calculation, ie

=IF(COUNTIFS(etc...)=0,"",COUNTIFS(etc...)/COUNTIFS(etc...))
 
Upvote 0
Welcome to the board.

You can use IFERROR

=IFERROR((COUNTIFS($B5:$B30,"x",D5:D30,">=70"))/(COUNTIFS($B5:$B30,"x",D5:D30,">=0"))*100,"N/A")
 
Upvote 0

Forum statistics

Threads
1,216,160
Messages
6,129,215
Members
449,494
Latest member
pmantey13

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