Get Your Numbers Right



The remainder after integer division. The portion of the dividend left over after dividing the divisor into it evenly as many times as possible. Same as Excel's built-in MOD function, but with high precision.

Rounds the quotient down (toward negative infinity) to an integer, multiplies it by the divisor, and subtracts that result from the dividend (see formula below), with up to 32,767 significant digits of precision. Result takes the sign of the divisor unless otherwise specified.

MOD(dividend, divisor) = dividend - (divisor x INT(dividend / divisor))



dividend Required. The number to be divided by divisor.
divisor Required. The number to divide into dividend.
sign Optional. Determines whether the sign of the return value is positive or negative. 3 by default.

sign value

1 Return value takes the sign of the result of the mod formula.
2 Return value takes the sign of the dividend.
3 Return value takes the sign of the divisor (Default)
4 Return value is always positive.
5 Return value is always negative.
format_negative Optional. Determines whether negatives are formatted with a leading hyphen ("-"), or parentheses ("()"). Set to 1 to format negatives with a leading hyphen. Set to 2 for parentheses. 1 by default.

You can also format negatives with a red font.

format_thousands Optional. Determines whether thousands separators are included. Set to TRUE to include thousands separators. FALSE by default.
format_currency Optional. Determines whether currency symbol is included. Set to TRUE to include currency symbol. The currency symbol will be added either to the beginning or to the end of the result, whichever is appropriate for the locale. FALSE by default.
exponential_notation Optional. Determines whether result is formatted in exponential notation. Set to TRUE to format in exponential notation. FALSE by default.
maximum_significant_digits Optional. Determines the maximum number of significant digits to be returned. Default is 100, or the user's custom maximum set in the About box, or the maximum number allowed by the edition of xlPrecision, whichever is less.



Formula Description Result
=xlpMOD(3,2) 3 - (2 x INT(3 / 2)) 1
=xlpMOD(3.3,2.2) 3.3 - (2.2 x INT(3.3 / 2.2)) 1.1
=xlpMOD(-3.3,2.2) (-3.3) - (2.2 x INT((-3.3) / 2.2))
(takes the positive sign of the divisor)
=xlpMOD(3.3,-2.2) 3.3 - ((-2.2) x INT(3.3 / (-2.2)))
(takes the negative sign of the divisor)
=xlpMOD(-3.3,-2.2) (-3.3) - ((-2.2) x INT((-3.3) / (-2.2)))
(takes the negative sign of the divisor)
=xlpMOD(3,-4) 3 - ((-4) x INT(3 / (-4)))
(takes the negative sign of the divisor)
(compare to xlpMODTRUNC)

See Also