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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER