We help IT Professionals succeed at work.

DIV error, excel 2016

hi experts, i have a DIV error in cell K7 & K13 on the attached excel 2016 worksheet (see screenshot below) but i dont understand how to fix, please assist.

'DIV' error
Comment
Watch Question

Ryan ChongSoftware Team Lead

Commented:

cell J7 is empty (zero), so you got a divided by zero error.

byundtMechanical Engineer
Most Valuable Expert 2013
Top Expert 2013

Commented:
J7 is blank, so your formula in K7 is dividing by 0. Use this formula in K7 (and copy it down) instead:
=IF(SUM(J7)=0,"",ROUNDUP(I13/J7,0)*J7)

Open in new window


Or you can require both I13 and J7 to have values:
=IF(OR(SUM(J7)=0, SUM(I13)=0),"",ROUNDUP(I13/J7,0)*J7)

Open in new window


I assume the formula in cell K13 is a SUM formula. If so, it will return 0 once you fix the formula in cell K7. If the formula in K13 tests whether the SUM is 0 and returns an empty string (looks like a blank) if so, it will still be fixed when you fix the formula in cell K7.
Frank .SBuilding Estimator

Author

Commented:
so does that mean i must have a value in cell j7 at all times otherwise the formula will show a 'DIV' error always?
- also, can the formula in k13 have an if statement that if there is zero or nothing in j7, then show nothing otherwise sum k7 to k12?
Ryan ChongSoftware Team Lead

Commented:

so does that mean i must have a value in cell j7 at all times otherwise the formula will show a 'DIV' error always?


Yup, since your formula use the value of J7 for division calculation.


also, can the formula in k13 have an if statement that if there is zero or nothing in j7, then show nothing otherwise sum k7 to k12?                                  

see if below is the one you looking for?


=IF(SUM(I13)=0,"",ROUNDUP(I13/ IF(J7=0,1,J7),0)*IF(J7=0,1,J7))


or:


=IF(SUM(I13)=0,"",IF(J7=0,ROUNDUP(I13,0),ROUNDUP(I13/J7,0)*J7))



Mechanical Engineer
Most Valuable Expert 2013
Top Expert 2013
Commented:
Frank,
Your original formula in cell K7 will show a #DIV/0! whenever cell J7 is empty. I suggested formulas in my first Comment to fix that problem.

Your formula in cell K13 will show a #DIV/0! is any cell in K7:K12 has a #DIV/0! error value. You may make that cell show an empty string (looks like a blank) by using:
=IFERROR(IF(SUM(K7:K12)=0,"",SUM(K7:K12)),"")

Open in new window


Brad
byundtMechanical Engineer
Most Valuable Expert 2013
Top Expert 2013

Commented:
Frank,
The problems in column L are likely very similar to those in column K. If you have difficulty getting the right formulas for L7:L13, please post your workbook.

Brad
Frank .SBuilding Estimator

Author

Commented:
hi brad, yes your solution k13 & k14 have worked as in it now shows nothing in these cells if J7 is blank.
- would i use the same "iferror" formula for k7?
byundtMechanical Engineer
Most Valuable Expert 2013
Top Expert 2013
Commented:
For cell K7, you might use:
=IFERROR(ROUNDUP(I13/J7,0)*J7,"")

Open in new window


That formula doesn't care whether J7 is blank (and therefore cause #DIV/0! error), or I13 is an empty string (to suppress a 0 sum) and would therefore cause a #VALUE! error..
Frank .SBuilding Estimator

Author

Commented:
thankyou experts for helping me with my ifstatements that have cleaned up my worksheet..