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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Division within a report

Status
Not open for further replies.

StuartStarrs

Programmer
Jan 29, 2003
2
GB
Hi

I have a report which totals all calls made to clients of a particular industry - it also totals the results of the calls to that industry. What I am now trying to do is have a calculated percentage field but when I do this I get an illegal division by 0 message. I have tried using conditional statements to only do the calculation when both fields are greater than null but no luck - this just brings up a 0 or 100 value in the field. Does anyone know any special rules or have a fail safe (ish) way of doing this

Thanks in advance

Stuart
 
Hi

A standard way of avoiding the divide by zero error is to check the value using the following formula

Crystal syntax:

If {file.FORECAST} = 0 Then
0
Else
{file.SALES} / {file.FORECAST}

GoldMine Report syntax:

.if.contact2->uinvtot=0.then.0.else.contact2->uinvtot/contact2->uf1price

Robert Colborne
CRM Solutions with GoldMine and HEAT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top