charlie82
Feb 11 2010, 08:17 PM
Hi All,
I met the below error when i try to run a report. "Division by Zero"
In my report i got this forumla "=Sum([ClaimedAmount]/[ValuableROE])"
I believe that the error is because of the forumla as some of the ClaimedAmount is empty.
Is there anyway I can change the code to be able to skip the empty field and only count the field with value?
Thanks in advance.
PropMgr
Feb 11 2010, 08:29 PM
Put an if statement around any division so that you test before trying to divide,
If less than say .01 then error
datAdrenaline
Feb 11 2010, 08:48 PM
>> I believe that the error is because of the forumla as some of the ClaimedAmount is empty. <<
The error is not due to ClaimedAmount being empty, it is due to ValuableROE being empty or zero. So that is the field that you wiould check for 0, as saccity was refering to. What I do is actually check that the divisor is greater than 0, instead of looking for a 0 or Null. But checking for greater than 0, you implicitly check for Null as well since a Null compared to >0 will yield a Null and thus take the 'Else' (False) branch of the IIf() function.
Sum(IIf(ValuableROE > 0, ClaimedAmount/ValuableROE, 0))
vtd
Feb 11 2010, 08:53 PM
>>I believe that the error is because of the forumla as some of the ClaimedAmount is empty.
Nope. The error is caused by the zero divisor, not the zero dividend. Thus, you need to check for valid value of [ValuableROE].
charlie82
Feb 12 2010, 01:04 AM
Yes yes.... i know what to do.
Thanks all!!!
vtd
Feb 12 2010, 05:08 PM
You're welcome... Glad we could help...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.