Documentation/Calc Functions/FLOOR.XCL

    From The Document Foundation Wiki
    Other languages:


    Function name:

    FLOOR.XCL

    Category:

    Mathematical

    Summary:

    Rounds a number to the nearest multiple of a significance value. The direction of rounding is dependent on the signs of the funtion's two arguments.

    Syntax:

    FLOOR.XCL(Number; Significance)

    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 either Number or Significance is non-numeric, then FLOOR.XCL reports a #VALUE! error.
    • If Number is equal to 0, then FLOOR.XCL returns 0.
    • If Significance is equal to 0, then FLOOR.XCL reports an invalid argument error (Err:502).
    • If Number is positive and Significance is negative, then FLOOR.XCL reports an invalid argument error (Err:502).

    The signs of the Number and Significance arguments define the direction of rounding as defined in the following table.

    Sign of Number Sign of Significance Direction of rounding
    +ve (>0) +ve (>0) Down (toward -∞)
    +ve (>0) -ve (<0) N/A (error condition)
    -ve (<0) +ve (>0) Down (toward -∞)
    -ve (<0) -ve (<0) Up (toward +∞)

    Additional details:

    General information about Calc's floor functions

    Note pin.svg

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

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

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

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

    Calc provides the FLOOR.MATH, and FLOOR.PRECISE functions to increase interoperability with Microsoft Excel, which provides two similar functions with the same names.

    Microsoft Excel's FLOOR 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 FLOOR.XCL function, as follows:

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

    Examples:

    Formula Description Returns
    =FLOOR.XCL(34.5; 4.5) Rounds down 34.5 to the nearest integer multiple of 4.5. 31.5
    =FLOOR.XCL(D1; D2) where cells D1 and D2 contain the values -45.67 and 2 respectively. Rounds down -45.67 to to the nearest integer multiple of 2. −46
    =FLOOR.XCL(−45.67; −2) Rounds up -45.67 to the nearest integer multiple of 2. −44

    Related LibreOffice functions:

    CEILING

    CEILING.MATH

    CEILING.PRECISE

    CEILING.XCL

    FLOOR

    FLOOR.MATH

    FLOOR.PRECISE

    INT

    ISO.CEILING

    ODF standard:

    NONE

    Related (or similar) Excel functions:

    FLOOR