Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculating a Percentage Post Reply Post New Topic
Author Message
jbattelle
Newbie
Newbie


Joined: 06 Feb 2012
Location: United States
Online Status: Offline
Posts: 25
Quote jbattelle Replybullet Topic: Calculating a Percentage
    Posted: 06 Jul 2012 at 8:54am
Hi all,
 
I am trying to do what I would think would be a pretty simple calculation. I have 3 numbers that I need to get a percentage from. Basically, I have a (x+y)/z=the desired precentage. ex: (1+2)/9*100 to equal 33.33%
 
Yet, there are many records that have zero's in the number, and I get a "Division by zero" error. I assume I need to write an IF statement to ignore any that have zeros in the record.
 
Any help would be great!
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 06 Jul 2012 at 10:11am
if {z} <> 0 then ({x}+{y})/{z}.  That will ignore the zero's (you will get a blank).

I hope this helps.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.032 seconds.