Forum Discussion

phatboyslim46's avatar
phatboyslim46
Copper Contributor
Oct 10, 2021
Solved

Excel IF Function

Hi everyone, I'm kinda stuck with this equation and it keep showing '#DIV/0!'. For you reference, this is the IF Equation I'm dealing with,   =IF(SUM(L20:N20)/SUM(L$18:N$18)=0,"",SUM(L20:N20)/SUM(L...
  • Riny_van_Eekelen's avatar
    Oct 10, 2021

    phatboyslim46 Dividing something by zero will return the #DIV/0! error. Dividing or multiplying zero by anything will return zero. The easiest way to deal with this is to use the formula does the calculation you want.

     

    =SUM(L20:N20)/SUM(L$18:N$18)*O$18

     

    and, indeed wrap it in IFERROR like so:

     

    =IFERROR(SUM(L20:N20)/SUM(L$18:N$18)*O$18,"")

     

    Now, if you also want to suppress a zero in cases where the sum of L20:N20 or the value in O18 equals zero, you can use custom formatting ( 0;0; )to display zeros as blanks.

Resources