The MOD function takes two arguments: number and divisor. Number is the number to be divided, and divisor is the number used to divide. Both arguments are required. If either argument is not numeric, the MOD function returns #VALUE!.

Equation

The result from the MOD function is calculated with an equation like this: where n is number, d is divisor, and INT is the INT function. This can create some unexpected results because of the way that the INT function rounds negative numbers down, way from zero: MOD with negative numbers is implemented differently in different languages.

Examples

Below are some examples of the MOD function with hardcoded values:

Negative numbers

The result from MOD carries the same sign as divisor. If divisor is positive, the result from MOD is positive, if divisor is negative, the result from MOD is negative:

Time from datetime

The MOD function can be used to extract the time value from an Excel date that includes time (sometimes called a datetime). With a datetime in A1, the formula below returns the time only: Detailed explanation here.

Large numbers

With very large numbers, you may see the MOD function return a #NUM error. In that case, you can try an alternative version based on the INT function:

Notes

MOD is often seen in formulas that deal with “every nth” value MOD is useful for extracting the time from a date MOD always returns a result in the same sign as the divisor. MOD will return a #DIV/0! error if divisor is zero To discard the remainder and keep the integer, see the QUOTIENT function.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.