Documentation/Calc Functions/ROUND

    From The Document Foundation Wiki
    Other languages:


    Function name:

    ROUND

    Category:

    Mathematical

    Summary:

    Rounds a number to the nearest multiple of a specified power of 10.

    Syntax:

    ROUND(Number[; Count])

    Returns:

    Returns a real value which is the specified number rounded to the required precision.

    Arguments:

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

    Count is an integer, or a reference to a cell containing that integer, that is used to specify the precision of the rounding. If Count is omitted, a default value of 0 is assumed. The value of Count is utilized as follows:

    • If Count is a positive integer, then rounding is to the right of the decimal separator. For example, if Count is equal to 1 then numbers are rounded to the nearest multiple of [math]\displaystyle{ \frac{1}{10}\text{th} }[/math]; if Count is equal to 2 then numbers are rounded to the nearest multiple of [math]\displaystyle{ \frac{1}{100}\text{th} }[/math]; and so on.
    • If Count is equal to zero, then rounding is to the nearest integer.
    • If Count is a negative integer, then rounding is to the left of the decimal separator. For example, if Count is equal to -1 then numbers are rounded to the nearest multiple of 10; if Count is equal to -2 then numbers are rounded to the nearest multiple of 100; and so on. The value returned by ROUND will always be an integer when Count is negative.

    The following conditions (including errors) may be encountered:

    • If either Number or Count is non-numeric, then ROUND reports a #VALUE! error.
    • If Count is a non-integer value, then it is rounded to the next integer in the direction of 0.

    Additional details:

    • This function rounds to the nearest appropriate value, depending on the precision selected. If Number is equidistant from two nearest values, then rounding is away from 0 to the value with the higher magnitude. For example, 7.5 is equidistant from 7 and 8 so that the formula =ROUND(7.5; 0) will return the value 8. Similarly, the formula =ROUND(-7.5; 0) will return the value -8.
    • If you obtain unexpected results from ROUND, check the following:
    1. Make sure that the number of displayed decimal places is not affected by the setting of the Limit decimals for general number format option in the General Calculations area of the Tools ▸ Options ▸ LibreOffice Calc ▸ Calculate dialog (LibreOffice ▸ Preferences ▸ LibreOffice Calc ▸ Calculate on macOS).
    2. Access the Numbers tab on the Format Cells dialog (Format ▸ Cells or equivalent interaction) to make sure that relevant cells do not have formatting applied that affects the number of displayed decimal places.

    Examples:

    Formula Description Returns
    =ROUND(2.348; 2) Here the function rounds 2.348 to 2 decimal places. 2.35
    =ROUND(D1; D2) where cells D1 and D2 contain the numbers -32.4834 and 3.2 respectively. The value of the Count argument is truncated to 3. Here the function rounds -32.4834 to 3 decimal places. −32.483
    =ROUND(2.348; 0) Here the function rounds 2.348 to the nearest integer. The alternative formula =ROUND(2.348) returns the same value. 2
    =ROUND(2.5) Here the function rounds 2.5 to the nearest integer. However, since 2.5 is equidistant from 2 and 3, the value 3 is selected. 3
    =ROUND(887.65; −2) Here the function rounds 887.65 to the nearest hundred. 900

    Related LibreOffice functions:

    INT

    ROUNDDOWN

    ROUNDUP

    TRUNC

    ODF standard:

    Section 6.17.5, part 2

    Related (or similar) Excel functions:

    ROUND