Rounding Up or Ceiling

1 post / 0 new
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
Rounding Up or Ceiling

IDEA and VB doesn't have a native function to round up or get the ceiling of a number.  What I mean is if you have the number 1.2 and you want to round up, if you use round() or int() you would get 1 instead of 2.  I found this function on the internet at http://www.xtremevbtalk.com/showthread.php?t=118971 that seems to work.  Here is the function that you can place into IDEA.

Function roundUp(dTempNumber As Double) As Integer
    roundUp = Sgn(-dTempNumber ) * Int(-Abs(dTempNumber ))
End Function