Formualizer Docs

MROUND

Rounds a number to the nearest multiple.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=MROUND(number, multiple)

Arguments

ArgumentTypeRequiredDefault
numbernumberRequired—
multiplenumberRequired—

Remarks

  • Returns 0 when multiple is 0.
  • Midpoints are rounded away from zero.

Error cases

  • If number and multiple have different signs, returns #NUM!.

Examples

Round 17 to the nearest multiple of five.

Formula =MROUND(17,5)

Expected result 15

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Use negative inputs on both sides of the rounding calculation.

Formula =MROUND(-17,-5)

Expected result -15

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A value already at a multiple stays in place.

Formula =MROUND(15,5)

Expected result 15

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Opposite signs for the number and multiple are rejected.

Formula =MROUND(17,-5)

Expected result #NUM!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Why does MROUND return #NUM! for mixed signs?

If number and multiple have different signs (excluding zero), MROUND returns #NUM!.

Implementation

Engine source

On this page