MOD function
Overview
MOD is a function of the Math and Trigonometry category that returns the remainder after one number (the dividend) is divided by another number (the divisor). The result has the same sign as the divisor.
Usage
Syntax
MOD(dividend, divisor) => remainder
Argument descriptions
- dividend (number, required). The number whose remainder is to be calculated.
- divisor (number, required). The number by which the dividend is divided.
Additional guidance
None.
Returned value
MOD returns a number that is the remainder after division, with the same sign as the divisor.
Error conditions
- In common with many other IronCalc functions, MOD propagates errors that are found in its arguments.
- If no argument, or more than two arguments, are supplied, then MOD returns the
#ERROR!error. - If either argument is not (or cannot be converted to) a number, then MOD returns the
#VALUE!error. - If the value of the divisor argument is 0, then MOD returns the
#DIV/0!error. - For more information about the different types of errors that you may encounter when using IronCalc functions, visit our Error Types page.
Details
- MOD follows the formula:
Since INT returns the greatest integer less than or equal to its argument (it rounds down), the remainder's sign matches the divisor, even though this might appear counterintuitive when the dividend and divisor have different signs.
Links
- For more information about the modulo operation, visit Wikipedia's Modulo page.
- See also IronCalc's QUOTIENT function.
- Visit Microsoft Excel's MOD function page.
- Both Google Sheets and LibreOffice Calc provide versions of the MOD function.