Documentation/Calc Functions/CEILING.MATH

    From The Document Foundation Wiki


    Function name:

    CEILING.MATH

    Category:

    Mathematical

    Summary:

    Rounds a number to the nearest multiple of a significance value. In most cases, the number is rounded up (toward +∞). However, a mode parameter is provided and when this is set to a non-zero value, then negative numbers are rounded down (toward -∞).

    Syntax:

    CEILING.MATH(Number [; Significance [; Mode]])

    Returns:

    Returns a real number that is the rounded value and is an integer multiple of the significance value.

    Arguments:

    Number is a real number, or a reference to a cell containing that number, that is the value to be rounded.

    Significance is a real number, or a reference to a cell containing that number, that is the significance value to be used. If omitted, Significance defaults to 1. The sign of Significance is ignored.

    Mode is a real number, or a reference to a cell containing that number, that is a Boolean mode indicator. Mode is only effective when Number is negative. If Mode is present and equal to any non-zero value (including TRUE), negative numbers are rounded down (toward -∞). If Mode is omitted, or equal to zero or FALSE, negative numbers are rounded up (toward +∞).

    • If any argument is non-numeric, then CEILING.MATH reports a #VALUE! error.
    • If either Number or Significance is equal to 0, then CEILING.MATH returns 0.

    Additional details:

    Details specific to CEILING.MATH function

    • With Significance set to -1 or +1, or defaulted to 1, and Mode set or defaulted to 0 or FALSE, CEILING.MATH provides functionality that implements the standard mathematical definition of a ceiling value.
    • CEILING.MATH is similar to the CEILING function, the difference between the two lying in the interpretation of the Significance argument. The CEILING function requires the Significance and Number arguments to have the same sign, whereas for CEILING.MATH the sign of the Significance argument is ignored.


    General information about Calc's ceiling functions

    Note pin.svg

    Note:
    For convenience, the information in this subsection is repeated on all pages describing Calc's ceiling functions.

    General introductory information about ceiling functions can be found at Wikipedia's Floor and ceiling functions page.

    Calc provides five functions that can be used to calculate the ceiling value of a number, and these are:

    The most important of these for many users will be the CEILING function, which implements the requirements laid out in Section 6.17.1 of ODF 1.2, Part 2.

    Calc provides the CEILING.MATH, CEILING.PRECISE, and ISO.CEILING functions to increase interoperability with Microsoft Excel, which provides three similar functions with the same names. Calc's CEILING.PRECISE and ISO.CEILING perform identical functions.

    Microsoft Excel's CEILING function accepts two arguments and so is not compliant with ODF 1.2. This difference in behaviour could lead to interoperability problems but these are avoided through the provision of the CEILING.XCL function, as follows:

    • When Calc saves a spreadsheet to Excel 2007-365 (*.xlsx) format, any call to Calc's CEILING function is converted to a call to Excel's CEILING.MATH function, and any call to Calc's CEILING.XCL function is converted to a call to Excel's CEILING function.
    • When Calc opens a spreadsheet in Excel 2007-365 (*.xlsx) format, any call to Excel's CEILING function is converted to a call to Calc's CEILING.XCL function.

    Examples:

    Formula Description Returns
    =CEILING.MATH(11.5) Significance defaults to 1 and Mode defaults to 0. The function rounds up 11.5 to the nearest integer multiple of 1. 12
    =CEILING.MATH(−11.5) Significance defaults to 1 and Mode defaults to 0. The function rounds up -11.5 to the nearest integer multiple of 1. −11
    =CEILING.MATH(7; 2.3) Mode defaults to 0. The function rounds up 7 to the nearest integer multiple of 2.3. 9.2
    =CEILING.MATH(−7; −2.3) Mode defaults to 0. The function rounds up -7 to the nearest integer multiple of 2.3 (the sign of the significance value is ignored). −6.9
    =CEILING.MATH(D1; D2; D3) where cells D1, D2, and D3 contain the numbers 10, 3, and 1 respectively. The function rounds up the value 10 to the nearest integer multiple of 3. The value of Mode is not significant for a positive number. 12
    =CEILING.MATH(−10; −3; 0) With Mode set to 0, the function rounds up the value -10 to the nearest integer multiple of 3 (the sign of the significance value is ignored). −9
    =CEILING.MATH(−10; −3; 7.6) With Mode set to a non-zero value, the function rounds down the value of -10 to the nearest integer multiple of 3 (the sign of the significance value is ignored). −12
    =CEILING.MATH(−3.6; ; TRUE()) Significance defaults to 1. With Mode set to a non-zero value, the function rounds down the value of -3.6 to the nearest integer multiple of 1. −4

    Related LibreOffice functions:

    CEILING

    CEILING.PRECISE

    CEILING.XCL

    FLOOR

    FLOOR.MATH

    FLOOR.PRECISE

    FLOOR.XCL

    INT

    ISO.CEILING

    ODF standard:

    None

    Related (or similar) Excel functions:

    CEILING.MATH since v.2013.