Function Math Reals Class

Ceiling

Ceiling of a real number. Number vNumber is rounded-up with precision vPrecision.

Signature (Visual Basic / VBA)

Public Function Ceiling( _
      ByVal vNumber As Variant _
    , Optional ByVal vPrecision As Variant _
    ) As Variant

Code Examples

    Ceiling(2.4) = 3
    Ceiling(2) = 2
    Ceiling(.6) = 1
    Ceiling(0) = 0
    Ceiling(-.6) = 0
    Ceiling(-2) = -2
    Ceiling(-2.4) = -2
    Ceiling(-1.4, .5) = -1
    Ceiling(-1.7, .5) = -1.5
    Ceiling(X, Y) = - Floor(-X, Y)

Parameters

Parameter Description
vNumber The number that is to be rounded-up. Function returns Null if vNumber is Null or cannot be fixed up to a number.
vPrecision The precision used when rounding vNumber. vPrecision defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

Note With a precision of 1 (one), function returns the smallest integer greater than or equal to vNumber.