• Resolved tiger2deuce

    (@tiger2deuce)


    Good morning, I am trying to fix an error that I am receiving from a formula within my tables. It is “!ERROR! division by zero.” I currently have the following formula =number_format((C13+G13*.5))/(C13+E13+G13),3) in the W% column (http://www.d2softball.com/gsc-standings/). I would like for it to show 0.000 when I have 0-0-0 in the cells. Could you help me out with this? I’ve been trying if/then statements but just cannot seem to get it to work out.

    Thanks!

    https://ww.wp.xz.cn/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thankyou for presenting all the relevant info, wish more people did that.

    Will this do the trick:
    number_format((C13+G13*.5))/(C13+E13+G13+0.000001),3)
    The error this introduces will not be significant.
    There will have to be an equation using “if”, but I am not sufficiently familiar with this plugin. Thankyou for drawing this plugin to my attention.

    Thread Starter tiger2deuce

    (@tiger2deuce)

    I kept the = sign in front of the equation and just added 0.000001 at the end like you showed above and it worked perfectly. Thank you for your help! Glad you found the plugin. It is awesome and Tobias (the developer) is most helpful!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    Thanks for that suggestion, RossMitchell! “Cheating” with a very small number is a nice trick here.
    The solution with an “IF” check should look like this:

    =NUMBER_FORMAT( IF( C13+E13+G13 = 0, 0.000, (C13+G13*.5))/(C13+E13+G13) ) , 3 )

    (You’d basically just check if the denominator is 0. If so, return the fallback value, if not, calculate the division.)

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Formula Error’ is closed to new replies.