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

I am using the following formula to

Status
Not open for further replies.

kchaudhry

Programmer
Nov 10, 2003
256
US
I am using the following formula to calcuate a summary field.

(Sum ({@LocalTransCurrentMonthT1}, {participant.id}) + Sum ({@OutTransCountCurrentMonthT1}, {participant.id}))/{@TotalProdCurrentMonthT1}*100

I get an error message as the value in the denominator is sometimes zero.

Can someone please guide me how to change the forumla so that I get a "0" in the field where the denominator is zero and perfrom regular division otherwise?

Thanks.

Kchaudhry
 
You need to check for 0 before performing the calc.
Code:
if {@TotalProdCurrentMonthT1} > 0 then
    (Sum ({@LocalTransCurrentMonthT1}, {participant.id}) +
     Sum ({@OutTransCountCurrentMonthT1}, {participant.id}))
     /{@TotalProdCurrentMonthT1}*100
else
   0 //or whatever the default value should be

~Brian
 
Brian,

As always you have been a great help.

Thanks,

Kchaudhry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top