Smart questions
Smart people
 Find A ForumFind An Expert
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Remember Me

Are you a
Computer / IT professional?
Join Tek-Tips now!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Just copy and paste the

#### Feedback

"...This site is like first coffee in the winter morning..."

#### Geography

Where in the world do Tek-Tips members come from?

# Help with % Formula - Division by Zero Warning

 Forum Search FAQs Links Jobs Whitepapers MVPs
 SBSMedicalTech (Programmer) 16 Apr 12 9:53
 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
 briangriffin (Programmer) 16 Apr 12 10:53
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}

 SBSMedicalTech (Programmer) 16 Apr 12 11:58
 Thank you kindly for your assistance.
 SkipVought (Programmer) 16 Apr 12 12:18
 Your formula logically seems to me to be 'up side down.' Seems it should be...{data.paymentamount}/{data.chargeamount} * 100If 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 1000%, actually mean as a result of YOUR formula?  Skip,Just traded in my old subtlety...for a NUANCE!

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!