Documentation/Calc Functions/MROUND

From The Document Foundation Wiki
Jump to navigation Jump to search
Other languages:
English • ‎Nederlands • ‎dansk • ‎español



Function name:

MROUND

Category:

Mathematical

Summary:

Rounds one real number to the nearest integer multiple of a second real number.

Syntax:

MROUND(Number; Multiple)

Returns:

Returns a real number that is the rounded value.

Arguments:

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

Multiple is a real number, or a reference to a cell containing that number, that is the multiple to be used in the rounding. The sign of the Multiple argument is not significant.

  • If either Number or Multiple is non-numeric, then MROUND reports a #VALUE! error.
  • If Multiple is equal to 0, then MROUND returns the value 0.

Additional details:

  • For real x and y (y <>0), MROUND implements the following formula:

[math]\displaystyle{ \text {MROUND}(x, y)~=~y\times \text{ROUND}\left(\frac{x}{y}\right) }[/math]

Examples:

Formula Description Returns
=MROUND(15.5; 3) Here the function rounds 15.5 to the nearest multiple of 3. 15
=MROUND(D1; D2) where cells D1 and D2 contain the numbers 1.4 and 0.5 respectively. Here the function rounds 1.4 to the nearest multiple of 0.5. 1.5
=MROUND(11; 2) Here the function rounds 11 to the nearest multiple of 2. Note that "halfway" cases are rounded away from zero. The formula =MROUND(11; -2) gives the same result because the negative sign of the Multiple argument is not significant. 12
=MROUND(-11; 2) Here the function rounds -11 to the nearest multiple of 2. Note that "halfway" cases are rounded away from zero. The formula =MROUND(-11; -2) gives the same result because the negative sign of the Multiple argument is not significant. -12

Related LibreOffice functions:

ROUND

ODF standard:

Section 6.17.4, part 2

Equivalent Excel functions:

MROUND