Link to home
Start Free TrialLog in
Avatar of LJ083198
LJ083198

asked on

rounding

Dim A,B,C as double
B = 5000
C = 400000    
 

A= Round(B/ C,3)
A = .0125  When I round it three places though, I get .012  What I want is .013  When I use this line of code instead
A= Round(CSng(B/ C,3) I get the desired result of A = .013

Is this the correct way to get the numbers to round up?
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LJ083198
LJ083198

ASKER

Sometimes the answer is so easy.....
Have fun....

Try this:

MsgBox Round(1 / 2, 0)
MsgBox Round(3 / 2, 0)
MsgBox Round(5 / 2, 0)
MsgBox Round(7 / 2, 0)
MsgBox Round(9 / 2, 0)


Result: 0, 2, 2, 4, 4

Great eh?

See also:
http://oldlook.experts-exchange.com/bin/Q.10113932