The MOD function returns the remainder of the division of two numbers.
MOD(
number,
divisor
)
- number: Dividend of the division or reference to the column that contains it.
- divisor: Divisor of the division or reference to the column that contains it.
The MOD function returns an integer.
This function works as follows: It considers the remainder of the division between the two numbers and, if this is a negative number, the divisor value is added the least number of times necessary so that the result is greater than zero. Then, if divisor is a negative number, the minus sign is applied to the result (regardless of the sign it had).
This implies that the result of the function always has the same sign as the divisor. If divisor is 0, the MOD function returns an error.
The MOD function applied to pairs of numbers in which the divisor is a positive number is shown below:
And the same function applied to the same pairs of numbers in which the divisor takes the negative value: