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

formula won't add correctly

Status
Not open for further replies.

mgossman

Technical User
Apr 20, 2001
18
US
I have what I thought was a simple formula, but it isn't adding for me. I have 2 formula fields Formula1=hours*120.00, Formula2 = hours*138.00. The Formula I'm having trouble with is Formula3=Formula1 + Formula2. It only calculates if both Formula1 and Formula2 have a value > 0 in them. If either one is 0, the formula returns nothing. What am I doing wrong?
 
Most likely, you have nulls, not zeros, in one of your fields. Click on file, options, reporting tab, and make sure "convert null values to default" is checked.

Also, always include your version of crystal in your post. Correct answers vary by version, and newer versions offer more options.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
I've tried that already, I've also tried including a tonumber statement in my formula for Formula1 and formula2 as follows: tonumber(formula1) + tonumber(formula2)
I'm running Crystal 9...
 
Please post your actual {table.field} and identify their datatypes, and also post the contents of your actual formulas.

-LB
 
As dgillz says, you are probably getting nulls. Try modifying your formulas, e.g. Formula1 as
Code:
if not isnull(hours)
and hours <> 0
then hours*120.00
else 0

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top