MROUND

The function MROUND rounds a number to a given multiple.

This function takes a two Numbers as input: a base number to round, and another number describing which place to round the base number to. It returns another Number: the given number, rounded to the specified place.

Declaration

MROUND(base_number, base) -> rounded_number

Parameters

base_number (required, type: Number) The number to round.

base (required, type: Number) The multiple to round to. This specifies which multiple to round to. For instance, a base of 10 will round the given number to the nearest ten, while a base of 0.01 will round the given number to the nearest hundredth.

Return Values

rounded_number (type: Number) The base number rounded to the given multiple.

Examples

The following example takes the the number 1.5 and rounds it to the nearest integer:

MROUND(1.5, 1) -> 2

The following example takes the number 5.8899 and rounds it to the nearest hundredth:

MROUND(5.8899, 0.01) -> 5.89

The following example takes the number 32 and rounds it to the nearest ten:

MROUND(32, 10) -> 30

Discussion

In terms of rounding functionality, the MROUND function behaves identically to the ROUND function; the only difference between the two is that MROUND uses a multiple to describe which place to round to, whereas ROUND uses the number of digits.

Last updated