-
May 26th, 2009, 10:53 PM
#1
Thread Starter
Addicted Member
rounding up number?
hi guys...
i have problem about rounding up.
this is my value 38495 . i want to rounding up that value to 38500.
how to do that?
-
May 26th, 2009, 11:28 PM
#2
Re: rounding up number?
MsgBox -Int(-38495 / 100) * 100
Int always rounds down, so by making a value negative it rounds it down making the value bigger (greater negative).
-
May 26th, 2009, 11:48 PM
#3
Thread Starter
Addicted Member
Re: rounding up number?
ok thanks. but when the value is 38403 it become 38500. why ?
-
May 27th, 2009, 12:19 AM
#4
Re: rounding up number?
It always rounds up. If you don't want that, then you need a different kind of rounding.
Bankers' rounding: MsgBox Round(38403 / 100, 0) * 100
Regular rounding: MsgBox Int(38403 / 100 + 0.5) * 100
The difference with bankers' and regular rounding is how they handle rounding numbers such as 0.5, 1.5, 2.5 - regular goes always up, bankers' goes up or down depending on whether the number is odd or even.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|