MOD function
Dividend
The number to divide.
Divisor
The number to divide the dividend
parameter by.
Returns
The remainder. This value has the same sign as the
dividend
parameter.
Returns the remainder after an integer division operation. MOD(5, 2)MOD(5; 2) returns 1, as 2 divides 5 into two parts (2 * 2 = 42 * 2 = 4), leaving a remainder of 1 (5 - 45 - 4).
Division without remainder
MOD can be used to check if a divisor can divide a number without leaving a remainder, in which case the result is 0. 3 divides 12 into four parts, with no remainder, meaning that MOD(12, 3)MOD(12; 3) returns 0.
Checking the remainder for zero is often used to do something every nth time. This formula returns every other item, { 1, 3, 5 }{ 1; 3; 5 }:
Related functions
The functions ISEVEN and ISODD can be seen as more specialized versions of this function.
These formulas return the same result:
These formulas also return the same result:
Use the QUOTIENT function to access the division result of an integer division operation instead of the remainder. While MOD(5, 2)MOD(5; 2) returns 1 — the remainder after dividing 5 by 2— QUOTIENT(5, 2)QUOTIENT(5; 2) returns 2, the actual result.
Examples
Returns 1, because 2 divides 5 into two parts (2 * 2 = 42 * 2 = 4), leaving a remainder of 1 (5 - 45 - 4).
Returns 0, because 2 divides 6 into three parts (2 * 3 = 62 * 3 = 6), leaving a remainder of 0 (6 - 66 - 6).
Returns the array { 1, 0 }{ 1; 0 }, because MOD(5, 2)MOD(5; 2) returns 1 and MOD(6, 2)MOD(6; 2) returns 0.