Question about decimal

G

Guest

Hi all

The round( 1/4, 1) will display 0.2, round( 2/3,1) will display 0.7 , the
first one is not rounded up , but the second is. Could you tell me which
function can do the same to differend kinds of numbers.

Clara
 
M

Marshall Barton

clara said:
The round( 1/4, 1) will display 0.2, round( 2/3,1) will display 0.7 , the
first one is not rounded up , but the second is. Could you tell me which
function can do the same to differend kinds of numbers.


Gee, you're really having a lot of fun with rounding ;-)

The Round function does "Bankers Rounding" which take a 5
and rounds towards the nearest even digit in the previous
position. I.e. .15 rounds to .2 and .25 rounds to .2

Even after all your questions on this topic, you still
haven't explained exactly what you really want to happen.
 
G

Guest

Hi Marshall,

only two digits will remain after decimal point, then if the third place
digit is greater or equal to 5, 1 will round up, otherwise the third will be
erased
(1) 0.123 become 0.12
(2) 0.125 become 0.13
(3) 0.128 become 0.13

Clara
 
M

Marshall Barton

clara said:
only two digits will remain after decimal point, then if the third place
digit is greater or equal to 5, 1 will round up, otherwise the third will be
erased
(1) 0.123 become 0.12
(2) 0.125 become 0.13
(3) 0.128 become 0.13


The rounding we were taught in grade school, right?

Use this kind of expression in a text box:
=Fix(thefield * 100 + .5) / 100

If you want to make that into your own rounding function so
you can use it just like the builtin Round function, add
this to a standard module:
Public Function MyRound(num As Variant) As Variant
MyRound = Fix(num * 100 + .5) / 100
End Function

Are you aware that this kind of rounding is less accurate
than the Round function's "Bankers Rounding" when you add a
column of rounded numbers?
 

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