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 gkittelson 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" error message

Status
Not open for further replies.

Hacim

Technical User
Sep 5, 2002
63
US
I get a "division by zero" message when I run a report with certain date ranges. Can I tell CR to ignor the sum that it is trying to use to divide by zero, or am I missing the point?
The formula it is referring to:
Sum({@Priority1_7days},{WO.Priority}) /
Sum({@#1'sClosed},{WO.Priority}) *100

The formula {@Priority1_7days} goes like this:
IF {WO.WOTYPE} = 'CM' AND {WO.PRIORITY} = 1 AND {WO.STATUS} IN ['M','C'] AND
{@CM DAYS TO COMPLETE} <=1 THEN 1 else 0

The formula {@#1'sClosed} goes like this:
IF {WO.WOTYPE} = 'CM' AND {WO.PRIORITY} = 1 AND {WO.STATUS} IN ['M','C'] THEN 1 ELSE 0

Any help would be appreciated.
 
Obviously, one of the 2 numbers is zero. This should work for you:

if Sum({@Priority1_7days},{WO.Priority}) = 0 or Sum({@Priority1_7days},{WO.Priority}) = 0 then
0
else
Sum({@Priority1_7days},{WO.Priority})/Sum({@Priority1_7days},{WO.Priority}) *100

Hope this comes out ok on your end!

Crystally yours,
Sam
 
I replaced one of the fields you had pasted twice and it seems to work. Thanks for your help. Unfortunately it is the obvious that thtows me the most.
 
Of course, you only need to check the denominator for a zero.

100 / 0 gives an error
0 / 100 gives an answer of 0

Steve Phillips, Crystal Consultant
 
Where would I check the denominator for a zero?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top