Author Topic: Division by zero error stops formula  (Read 2291 times)

Tags:
  • All members
  • Posts: 15
  • Karma: +0/-0
Division by zero error stops formula
« on: Thu, 14 July, 2011, 12:02 »
Since division by zero errors seem to stop formulas in their tracks, I designed an IF statement to get around one.  However, I STILL get a division by zero error, which makes no sense.  Maybe someone here could tell me why.  Here's the statement:
IF(r_12_back_price=0,10000,1/r_12_back_price)

In English, that statement says if runner 12's back price is 0 (which is what happens when a field size is smaller than 12), return 10000; otherwise, return 1/back_price.  To my mind, I should never get a division by zero error yet I get one every time I hit a race with fewer than 12 runners.

Any thoughts as to why this is happening?

  • Élite
  • Posts: 4458
  • Karma: +252/-10
  • Gender: Male
*
Re: Division by zero error stops formula
« Reply #1 on: Thu, 14 July, 2011, 13:53 »
hi
its because the error checking of the spreadsheet/program language i would think ?.
but to get over this use
IF(r_12_back_price=0,10000,1/(.001+r_12_back_price))


mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 15
  • Karma: +0/-0
Re: Division by zero error stops formula
« Reply #2 on: Thu, 14 July, 2011, 14:04 »
But shouldn't it stop parsing the IF statement once it hits "value if true" (in this case 10000)?  It seems like it's then continuing on and reading the "value if false" statement and returning the division by zero error.  If that's the case, then that's a bug in MF's internal formula program.

  • Tim Vetrov
  • Administrator
  • Posts: 4569
  • Karma: +18/-0
  • Gender: Male
*
Re: Division by zero error stops formula
« Reply #3 on: Thu, 14 July, 2011, 18:52 »
I would add this one as a solution:
1/IF(r_12_back_price=0,0.00001,r_12_back_price)
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT