Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Division By Zero 1

Status
Not open for further replies.

fhurmuzlu

Programmer
Nov 16, 2004
52
US
At our work we use Crystal reports 8.5, when I
creat 1 report I`ll get a "division by zero"
error message. The formula is:
{vw_Potential_Summary.Annualized_Sales}/
{vw_Potential_Summary.Potential_Purchases}
This should work, what does a "division by
zero"" means, what`s wrong with this formula?
 
It means that you can't divide by 0 and {vw_Potential_Summary.Potential_Purchases} must be 0 in one of your records.

Change your formula to test for 0 before trying the division:

if {vw_Potential_Summary.Potential_Purchases} = 0 then
0
else
{vw_Potential_Summary.Annualized_Sales}/
{vw_Potential_Summary.Potential_Purchases}

BTW, this is the certification forum. In the future, try this forum: forum767


~Brian
 
I encounter that problem often, and find that one or more irritating records are zero, and can therefore not do the calculation. I over come that by changing the zero's to a 1:

{vw_Potential_Summary.Annualized_Sales}/
(If {vw_Potential_Summary.Potential_Purchases} = 0 then 1
else {vw_Potential_Summary.Potential_Purchases})

Which will leave {vw_Potential_Summary.Annualized_Sales} unchanged...not sure if this will suit your requirement though, but give it a try!!!



Etienne Oosthuysen
Hertfordshire, England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top