MOD
Returns the remainder after division, with the sign of the divisor.
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
=MOD(number, divisor)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | number | Required | — |
divisor | number | Required | — |
Remarks
- Result sign follows Excel-style MOD semantics (sign of divisor).
- Errors in either argument are propagated.
Error cases
- If divisor is
0, returns#DIV/0!.
Examples
Divide two positive integers with a remainder.
Formula =MOD(17,5)
Expected result 2
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?.
Compare the result when the first number is negative.
Formula =MOD(-17,5)
Expected result 3
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?.
Divide integers with no remainder.
Formula =MOD(15,5)
Expected result 0
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 zero denominator makes the operation undefined.
Formula =MOD(17,0)
Expected result #DIV/0!
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?.
Positive divisor
Formula =MOD(10,3)
Expected result 1
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?.
Negative dividend
Formula =MOD(-3,2)
Expected result 1
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?.
Related functions
FAQ
Why can MOD return a positive value for a negative dividend?
MOD follows the sign of the divisor, matching Excel's modulo semantics.