how can I get round the error message "division by zero".<br>
In essence I need to calculate the percentage by which an invoice exceeds its original value. (x-y)/y*100. Some order values have zero values, hence the error message.
Division by zero is mathmatically "undefined", so hence all arithemetic operations that run into it generate (or should generate) an error mesage. In your situation, it seems like you want to show the percentage change. However, if the {y} amount is zero, the percentage change is not relevant, so maybe you should show something like "N/A" in that case.<br>
To calc the percent;<br>
If {y} <> 0 then<br>
{x}-{y}%{y} // or ({x}-{y}/{y})*100<br>
Else<br>
0 // this result will be suppressed, but it is here so that the formula is logically complete<br>
<br>
Suppress this formula, using the following formula<br>
{y} = 0<br>
<br>
Now, part two. To indicate "N/A", just drop "N/A" into a text box and format to suppress with the following formula. <br>
{y} <> 0<br>
Put the text box on top of the first formula. Should work. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.