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!

Help with % Formula - Division by Zero Warning 1

Status
Not open for further replies.

SBSMedicalTech

Programmer
Apr 16, 2012
21
US
I am needing help creating a Percentage Formula. When I ran my original formula, I got back a division by zero error. My hunch tells me I need to account for values in zero with IF and ELSE somehow. Basically I need to know the collection ratio and account for zero payments. Any assistance is appreciated.

{data.ChargeAmount}/{data.PaymentAmount} * 100
 
Not sure why post is being doubled...

Depending on your database, you may need to trap for nulls also:

Code:
if isnull({data.paymentamount})
or {data.paymentamount} = 0
then 0

else

{data.chargeamount}/{data.paymentamount} * 100



You can also eliminate the "* 100" by using:

{data.chargeamount}%{data.paymentamount}
 

Your formula logically seems to me to be 'up side down.' Seems it should be...
[tt]
{data.paymentamount}/{data.chargeamount} * 100
[/tt]
If the account holder has paid NOTHING on a chargeamount of 1000, then the percent paid is 0%

If the account holder has paid 100 on 1000, then the percent paid is 10%.

So what would (1000/100) * 100, which equals [highlight]1000%[/highlight], actually mean as a result of YOUR formula?







Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top