ID EN
#Math

MOD

Excel Functions

Get the remainder from division

Syntax

EXCEL
=MOD(number, divisor)

Arguments

Parameter Description
number The number to be divided.
divisor The number to divide with.

Return Value

The remainder

Details

The MOD function returns the remainder after division. For example, MOD(3,2) returns 1, because 2 goes into 3 once, with a remainder of 1. 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!. 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

Equation

The result from the MOD function is calculated with an equation like this:

EXCEL
=n-d*INT(n/d)
Equation

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

EXCEL
=MOD(7,3) // returns 1
=MOD(7,-3) // returns -2
Examples

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

EXCEL
=MOD(12,3) // returns 0
=MOD(12,5) // returns 2
=MOD(100,33) // returns 1
=MOD(6.25,1) // returns 0.25
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

EXCEL
=MOD(-3,2) // returns 1
=MOD(3,-2) // returns -1
=MOD(-3,-2) // returns -1
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

EXCEL
=MOD(A1,1) // return time only
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:

EXCEL
=number-(INT(number/divisor)*divisor)

See Also

QUOTIENT