Rounding ERROR

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?
 
J

John Vinson

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top