Removing #DIV/0 but could be more complicated...

mtaylor

Board Regular
Joined
May 1, 2013
Messages
73
Platform
  1. Windows
  2. MacOS
This is used for registration in a school during this Coronavirus situation.

Essentially teachers input the codes and a percentage is then calculated. This data is then analysed on another sheet showing the students absent for less than 61% of the week.

My issue is that if a teacher doesn't input a code for a student for the whole week a #DIV/0 code is given which affects the outcome of the sheet showing all the names.

Hopefully these pics will explain better...

KG1C
NameTotal %22/0323/0324/0325/0326/03Week 1 %29/0330/0331/0301/0402/04Week 2 %05/0406/0407/0408/0409/04Week 3 %12/0413/0414/0415/0416/04Week 4 %19/0420/0421/0422/0423/04Week 5 %26/0427/0428/0429/0430/04Week 6 %28/0429/0430/04Days Present Total
Tom100ppppp100pPPPP100PPPPP100PPPPP100PPPPP100PPPPP10030
****63PPpUAUA60UApUAPP60PPUAPP80PPPUAP80LUAPPUA60PPUAUAUA4019
harry96lpppl100plPPP100PPPPP100PPPPP100AAPPPP80#DIV/0!24
Bill62UAUAllp60lpUAUAUA40AAAAPPP60PPPPP100PPPUAUA60O016
Ben100pPppp100pPPPP100PPPPP100PPPPP100PPPPP100PPPPP10030

Week 6. I put the 'O' in to see if that was the problem and it works...

1588321496022.png


Below is the formula for the adding of names from the class sheets to the sheet showing less than 61% attendance children.

1588321428133.png


Many thanks in advance. My apologies if this is something basic. ?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi, avoiding "#DIV/0!" can be done like = IFERROR(your formula, "").
 
Upvote 0
Hi, avoiding "#DIV/0!" can be done like = IFERROR(your formula, "").
Like this:

=IFERROR((COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L")) / COUNTIF(AG3:AK3,"*") *100),"")

I get an error msg adding it like this...
 
Upvote 0
Maybe the below (untested as I can't copy/paste your image) and a couple of brackets in there just for clarity...
=IFERROR((COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L") )/(COUNTIF(AG3:AK3,"*") *100),"")
 
Upvote 0
For division by zero, you can specifically check the denominator rather that relying on the generic IFERROR function (which could hide other errors that you want to know about).
If the codes in AG:AK are being entered manually by the teachers then try

=IF(COUNTA(AG3:AK3),(COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L"))/COUNTA(AG3:AK3),"")
 
Upvote 0
For division by zero, you can specifically check the denominator rather that relying on the generic IFERROR function (which could hide other errors that you want to know about).
If the codes in AG:AK are being entered manually by the teachers then try

=IF(COUNTA(AG3:AK3),(COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L"))/COUNTA(AG3:AK3),"")
Thanks Peter,
I couldn't work out where the *100 would go in the formula, I kept getting ERROR messgaes occur.

I think I can work it through using:

=IFERROR(((COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L")) / COUNTIF(AG3:AK3,"*") *100))

That seems to get the job done.

Thanks again

Matt
 
Upvote 0
Maybe the below (untested as I can't copy/paste your image) and a couple of brackets in there just for clarity...
=IFERROR((COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L") )/(COUNTIF(AG3:AK3,"*") *100),"")

Thanks Mark,
It turns out the formula you suggested messed with my division somewhat.

I had a play though and found that this works:

=IFERROR(((COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L")) / COUNTIF(AG3:AK3,"*") *100))

Thanks again

Matt
 
Upvote 0
I couldn't work out where the *100 would go in the formula,
Sorry, that was my mistake - I accidentally left it out. you shouldn't need an IFERROR. Try this one instead.

20 05 01.xlsm
AGAHAIAJAKAL
3PPPPP100
4pPUAUAUA40
5 
6O0
7PPPPP100
Avoid Div 0
Cell Formulas
RangeFormula
AL3:AL7AL3=IF(COUNTA(AG3:AK3),(COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L"))/COUNTA(AG3:AK3)*100,"")
 
Upvote 0
Sorry, that was my mistake - I accidentally left it out. you shouldn't need an IFERROR. Try this one instead.

20 05 01.xlsm
AGAHAIAJAKAL
3PPPPP100
4pPUAUAUA40
5 
6O0
7PPPPP100
Avoid Div 0
Cell Formulas
RangeFormula
AL3:AL7AL3=IF(COUNTA(AG3:AK3),(COUNTIF(AG3:AK3,"P")+COUNTIF(AG3:AK3,"L"))/COUNTA(AG3:AK3)*100,"")

Smashing - Cheers Peter
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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