# Documentation/Calc Functions/MOD

Other languages:
English • ‎Nederlands • ‎dansk • ‎español • ‎עברית

MOD

Mathematical

## Summary:

Calculates the remainder when one number (the dividend or numerator) is divided by another number (the divisor or denominator). This is known as the modulo operation.

Often the dividend and divisor will be integer values (Euclidean division). However, MOD accepts and processes real numbers with non-zero fractional parts.

## Syntax:

MOD(Dividend; Divisor)

## Returns:

Returns a real number that is the remainder when one number is divided by another number. The value returned has the same sign as the divisor.

## Arguments:

Dividend is a real number, or a reference to a cell containing that number, that is the dividend of the divide operation.

Divisor is a real number, or a reference to a cell containing that number, that is the divisor of the divide operation.

• If either Dividend or Divisor is non-numeric, then MOD reports a #VALUE! error.
• If Divisor is equal to 0, then MOD reports a #DIV/0! error.

• For real x and y (y <>0), MOD implements the following formula:

$\displaystyle{ \text{MOD}(x,y)~=~x-\left(y\times \text{INT} \left(\frac{x}{y}\right)\right) }$

The INT function always rounds down (toward -∞) and returns the largest integer less than or equal to a given number. This means that when the dividend and divisor have different signs, MOD may produce results that appear counterintuitive. For example, the formula =MOD(7, -3) returns -2; this is because the fraction $\displaystyle{ \left(\frac{7}{-3}\right) }$ is rounded to -3 by the INT function.
• For more general information about the modulo operation, visit Wikipedia’s Modulo operation page.

## Examples:

Formula Description Returns
=MOD(11; 3) Here the function returns the remainder when 11 is divided by 3. The returned value has the same sign as the divisor, which is positive in this example. 2
=MOD(-11; 3) Here the function returns the remainder when -11 is divided by 3. The returned value has the same sign as the divisor, which is positive in this example. Note the counterintuitive value produced when the dividend and divisor have different signs. 1
=MOD(11; -3) Here the function returns the remainder when 11 is divided by -3. The returned value has the same sign as the divisor, which is negative in this example. Note the counterintuitive value produced when the dividend and divisor have different signs. -1
=MOD(-11; -3) Here the function returns the remainder when -11 is divided by -3. The returned value has the same sign as the divisor, which is negative in this example. -2
=MOD(D1; D2) where cells D1 and D2 contain the numbers 11.25 and 2.5 respectively. Here the function returns the remainder when 11.25 is divided by 2.5. The returned value has the same sign as the divisor, which is positive in this example. 1.25

MOD