Documentation/Calc Functions/MROUND

From The Document Foundation Wiki
Jump to: navigation, search
Other languages:
English

Function name:

MROUND

Category:

Mathematical

Summary:

Returns a number rounded to the nearest multiple of another number.

Syntax:

MROUND(Number; Multiple)

Returns:

Returns Number rounded to the nearest multiple of Multiple.

Arguments:

Number is a real number or a reference to the cell containing that number which is to be rounded to the nearest multiple of Multiple.

Multiple is a real number or a reference to the cell containing that number whose nearest integer multiple the Number is to be rounded.

  • In case the Number is negative, its absolute value is considered for multiple selection and then the sign is multiplied to the result.
  • Sign of Multiple is ignored.
  • In case the Number is equally close to two consecutive multiples of Multiple, i.e. it lies midway then higher absolute valued multiple is returned by the function.

Additional details:

An alternative implementation would be Multiple * ROUND(Number/Multiple).

Examples:

Formula Description Returns
=MROUND(15.5;3) rounds 15.5 to nearest multiple of 3, i.e. 15.5 is closer to 15 (= 3*5) than to 18 (= 3*6) 15
=MROUND(1.4;0.5) rounds 1.4 to nearest multiple of 0.5, i.e. 1.4 is closer to 1.5 (= 0.5*3) than to 1.0 (= 0.5*2) 1.5
=MROUND(11;2) rounds 11 to nearest multiple of 2, i.e. 11 is as closer to 12 (= 2*6) as to 10 (= 2*5) so taking higher value 12
=MROUND(-11;2) rounds -11 to nearest multiple of 2 but -11 is as closer to -12 (= 2*-6) as to 10 (= 2*-5) so taking higher absolute valued multiple -12
=MROUND(-11;-2) rounds -11 to nearest multiple of 2,ignoring the sign -12
=MROUND(11;-2) rounds -11 to nearest multiple of 2, ignoring the sign 12

Related LibreOffice functions:

ROUND

ODF standard:

Section 6.17.4, part2

Equivalent Excel functions:

MROUND