1. Registered User
Join Date
Mar 2004
Posts
361

Here is my function,

=([txtMatApr]*0.45)

Right now it comes to 40.25. How do I round that to the nearest whole number? Thanks.

2. Registered User
Join Date
Mar 2004
Location
Nashville, TN
Posts
557
Make that field have no decimal places by going to properties of the text box and setting that.

Let me know if you understand and if that works.
JS

3. Registered User
Join Date
Apr 2004
Location
Sydney Australia
Posts
369
Do what JSThePatriot says if want the display to change but not the number. In other words the 43.25 will show as 43 but in a calculation it will retain 43.25. In fact if click on the 43 it will expand out to the 43.25.

Try CInt or CLng if you want the number truly rounded. That is 43.25 becomes a true 43.

Mike

4. Registered User
Join Date
Mar 2004
Posts
361
Thanks, that worked great!

5. Registered User
Join Date
Oct 2003
Posts
706
When you are doing calculations, you want all the precision that the computer can internally provide.

When you are producing output, some amount of rounding will occur (in addition to the internal conversion of a binary number to base-10), and you can control that to obtain exactly the output that you need.

However, it is vitally important that you remember that the sum of rounded numbers is not equal to the rounded sum of numbers! If you present a column of figures, each one rounded to two places, and the sum of those figures ... you can bet your bottom dollar that someone will add those figures up from the report, find them +/- \$0.01 or so from the total, and scream bloody murder! "You incompetent fool! This report is wrong!"

And it is... and it isn't.

The computer took the un-rounded original data, added up each value, rounded the result and printed it out: the rounded sum of numbers. But your boss (or your client...) took the printout, which consists of individually rounded numbers, added them up (the sum of rounded numbers...) and found the discrepancy.

Which one is more accurate? Well, the computer's sum. But try convincing a client of that! Especially if they haven't paid your bill, and won't pay until you make those numbers "add up!"

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•