Rounding ERROR

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

There is a sub-report in my main report that displays premium amounts. These
pulled from a table. On the main report is a SUM of the premium, which
defaults to $100.

=IIf(Sum([GPROJ_PREM])<100,100,Sum([GPROJ_PREM]))

I have noticed that some of the sums are wrong. For instance $830 plus $26 =
$855. The original amounts carried out are 829.5041 and 25.6900.

How can I get the correct SUM?
 
There is a sub-report in my main report that displays premium amounts. These
pulled from a table. On the main report is a SUM of the premium, which
defaults to $100.

=IIf(Sum([GPROJ_PREM])<100,100,Sum([GPROJ_PREM]))

I have noticed that some of the sums are wrong. For instance $830 plus $26 =
$855. The original amounts carried out are 829.5041 and 25.6900.

How can I get the correct SUM?

Hrm. 829.5041 + 25.69 = 855.1941, which rounds to 855. Looks to me
like you got the CORRECT answer, and you want an incorrect one! <g>

What's happening is that the numbers are being added with full
precision and THEN rounded. If you prefer, use Sum(Round([fieldname],
0)) to round to the nearest dollar first and then sum those rounded
values.

John W. Vinson[MVP]
 
Back
Top