MROUND

Rounds a number (using the common rule) to the closest multiple of another number

Usage

MROUND(number, [multiple_of])

Parameters

number

(Required) The number

multiple_of

The multiple to round to (by default 1). The sign has no impact on the result.

Examples

Example With these variables Result

MROUND(10)

(None)

10

MROUND(10.1)

(None)

10

MROUND(10.5)

(None)

11

MROUND(10.9)

(None)

11

MROUND(number)

number is -10.1

-10

MROUND(-10.5)

(None)

-11

MROUND(-10.9)

(None)

-11

MROUND(6.05, 0.1)

(None)

6.1

MROUND(7.05, 0.1)

(None)

7.1

MROUND(10.9, 2)

(None)

10

MROUND(11, 2)

(None)

12

MROUND(-10.9, 2)

(None)

-10

MROUND(-11, 2)

(None)

-12

More information

If number is already a multiple of multiple_of, then number is returned as is.

Values at the mid-point (ex: MROUND(0.5, 1)) are rounded away from zero.

Reminders

A text containing digits is not handled as a number. To have an actual number:

  • use the @NUMBER_QUESTION to set the variable
  • write a numeric value directly in the code without quotes, ex: age >= 18
  • use a function which converts to a number: NUMBER(text_containing_numbers)
  • use a function which returns a number: FIND("world", "hello everybody")

See also