I have a client who needs his fee rounded up. The VB round() is smart enough to round up or down, so
4.236 = 4.24 4.231 = 4.23
But... he wants 4.231 to also round UP to the nearest penny (=4.24)
Anyone have a code snippet to share? Thanks :-)
txbakers
5:06 pm on Oct 21, 2004 (gmt 0)
not sure of the syntax but here it is:
amt = 4.321
if amt mod cint(amt) > 0 then amt = cint(amt) + 1 end if
will round up to the next integer.
I imagine you could do the math to lower decimals as well. Just check to see if the modulus is > 0, and if so, always round up.
dotme
5:36 pm on Oct 21, 2004 (gmt 0)
Well, that didn't work quite as I expected, but when I searched on some key text in your response, I found a fix. I'm posting the solution I found below in case it's useful for anyone else.
Thanks for helping me out!
DotMe
amt = 4.2423432 amt = amt * 100 amt = roundup(amt) amt = amt / 100 response.write amt
Function roundup(Num) RoundUp = -Int(-Num) End Function