Round-up At Round About!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to round up value?
Example
$58.93 ==> $ 58.90
$58.97 ==> $ 59.00

and others according to custom rounding-up
(i may not round up $58.93 to 58.90 but may be to $59.00)

Any solutions?

Thanks in advance.

Kennykee
 
Create a function to do your rounding that accepts 2 parameters. The first is
your intital number and the second is the number of decimal places to round
to.
In this example I will send in 58.93 and 1 decimal place.

Function Round_Up(dNum As Double, nDP as Integer) As Double
dNum = int(dNum * 10 ^ nDP + 0.5) / 10 ^ nDP
Round_Up = dNum
End Function
 
Thanks for the function but how about the code for [Price] afterupdate event?
Assume the $58.93 is a value in the [Price]

Any ideas?

Thanks in advance.

Kennykee
 
In the after Update event simply put

Price = Round_Up(Price,1)

kennykee said:
Thanks for the function but how about the code for [Price] afterupdate event?
Assume the $58.93 is a value in the [Price]

Any ideas?

Thanks in advance.

Kennykee

Dennis said:
Create a function to do your rounding that accepts 2 parameters. The first is
your intital number and the second is the number of decimal places to round
to.
In this example I will send in 58.93 and 1 decimal place.

Function Round_Up(dNum As Double, nDP as Integer) As Double
dNum = int(dNum * 10 ^ nDP + 0.5) / 10 ^ nDP
Round_Up = dNum
End Function
 
Dennis,

Your brain is extremely incredible. I never thought such technique
before(redivide own values)

Thank you very very much.

Kennykee


Dennis said:
In the after Update event simply put

Price = Round_Up(Price,1)

kennykee said:
Thanks for the function but how about the code for [Price] afterupdate event?
Assume the $58.93 is a value in the [Price]

Any ideas?

Thanks in advance.

Kennykee

Dennis said:
Create a function to do your rounding that accepts 2 parameters. The first is
your intital number and the second is the number of decimal places to round
to.
In this example I will send in 58.93 and 1 decimal place.

Function Round_Up(dNum As Double, nDP as Integer) As Double
dNum = int(dNum * 10 ^ nDP + 0.5) / 10 ^ nDP
Round_Up = dNum
End Function


:

How to round up value?
Example
$58.93 ==> $ 58.90
$58.97 ==> $ 59.00

and others according to custom rounding-up
(i may not round up $58.93 to 58.90 but may be to $59.00)

Any solutions?

Thanks in advance.

Kennykee
 
Back
Top