Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004

    Unanswered: Round a fraction

    Here is my function,


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

  2. #2
    Join Date
    Mar 2004
    Nashville, TN
    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.
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting by Patriot Designs

  3. #3
    Join Date
    Apr 2004
    Sydney Australia
    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.


  4. #4
    Join Date
    Mar 2004
    Thanks, that worked great!

  5. #5
    Join Date
    Oct 2003
    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!"
    ChimneySweep(R): fast, automatic
    table repair at a click of the

Posting Permissions

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