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!

Removing Zero from a Field 2

Status
Not open for further replies.

nysouth

IS-IT--Management
Jul 23, 2003
21
US
I am trying to compare percentage of growth from one year to a next. If there is a value for this year, but not one for the last year the value is coming through as zero. To show the percentage of growth. This is against mathmatical law to divide by zero and the report crashes when it comes to a record that has the zero value. How can I remove these zeros?

Colleen
 
You can create a formula like this:

if {table.denominatorfield}//replace with your fields
> 0
then
{table.numeratorfield}/{table.denominatorfield}//replace with your fields
else
0

Hope this helps!

Kchaudhry
 
You may need to expand upon this to allow for nulls since you say it has nothing in there:

if not(isnull({table.denominatorfield}))
and
{table.denominatorfield} <> 0
then
{table.numeratorfield}/{table.denominatorfield}//replace with your fields
else
0

Note that I also changed it from being > 0 to <> 0 as you might have a negative number.

-k
 
synapsevampire,

Thanks, your formula makes more sense.

Appreciate the correction :)

Kchaudhry
 
Thanks to both of you. It worked great! - Colleen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top