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!

Value 0 gives percentage error

Status
Not open for further replies.

Monkey820

Technical User
Dec 11, 2003
62
US
If the {table.GOOD_PTS} value is 0, I get a "Division by zero" error. What formula should I use to consider this possiblity? I want to see a percentage but there will be some values of 0 in the report and, of course, I do not need to calculate them. But the other values in the report will need to have the calculation.

{table.MISSING_PTS}/Sum ({table.GOOD_PTS}

Micky
CRW8.5
 
Try:

if Sum ({table.GOOD_PTS} = 0 then
0
else
{table.MISSING_PTS}/Sum ({table.GOOD_PTS}

-k
 
Ooops, you had a typo and I copied:

if Sum ({table.GOOD_PTS}) = 0 then
0
else
{table.MISSING_PTS}/Sum ({table.GOOD_PTS})

-k
 
And I think it should be:...

if Sum ({table.GOOD_PTS}) = 0 then
0
else
({table.MISSING_PTS}/Sum ({table.GOOD_PTS}))*100

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top