Add 2 Sum fields

  • Thread starter Thread starter Eddie Jackson
  • Start date Start date
E

Eddie Jackson

Hi
I reckon I can't do what I am trying to do.

=Sum([Nominal])-Sum([NominalSold])

I have this formula in a box on a form footer. . The formula posted is in
one box only, and is trying to do the calculation in one operation.I can run
2 boxes each with =sum and both sum their relevant fields and this gives me
both relevant sums.
How do I subtract one from the other?
Any suggestions?
Thanks
Eddie
 
Eddie said:
Hi
I reckon I can't do what I am trying to do.

=Sum([Nominal])-Sum([NominalSold])

I have this formula in a box on a form footer. . The formula posted
is in one box only, and is trying to do the calculation in one
operation.I can run 2 boxes each with =sum and both sum their
relevant fields and this gives me both relevant sums.
How do I subtract one from the other?
Any suggestions?
Thanks
Eddie

I can think of no reason why that shouldn't work. What do you get?
 
The answer I am getting is "-9.09494701772928E-13" when the answer should be
"0" Tables are formatted to double-auto decimal. Field properties on the
form are left blank. I don't know where the "E" is coming from.
Hope you can help
Regards
Eddie


Rick Brandt said:
Eddie said:
Hi
I reckon I can't do what I am trying to do.

=Sum([Nominal])-Sum([NominalSold])

I have this formula in a box on a form footer. . The formula posted
is in one box only, and is trying to do the calculation in one
operation.I can run 2 boxes each with =sum and both sum their
relevant fields and this gives me both relevant sums.
How do I subtract one from the other?
Any suggestions?
Thanks
Eddie

I can think of no reason why that shouldn't work. What do you get?
 
Eddie said:
The answer I am getting is "-9.09494701772928E-13" when the answer
should be "0" Tables are formatted to double-auto decimal. Field
properties on the form are left blank. I don't know where the "E" is
coming from. Hope you can help
Regards
Eddie

What you are seeing is the normal rounding issue when using imprecise number
types (Single and Double). These do not store exact values for all numbers,
but merely approximations and in some cases you get stuff like this.

I generally use Currency when I need decimal places to avoid this issue. In
the newer versions you can also use the Decimal type, but that type is not
implemented perfectly in Access/Jet. Otherwise you have to "pre-round" or
do imprecise comparisons instead of exact comparisons (test for "less than a
very small value" rather than testing for zero).
 
Back
Top