Excel Function Reference

MOD

Returns the remainder after division: how many items won’t fit into full boxes, how many minutes are left over after whole hours.

MOD(number, divisor)
number
What you divide.
divisor
What you divide by. Zero gives a #DIV/0! error.

Return value

The remainder after division. It has the same sign as the divisor. Dividing by 0 gives a #DIV/0! error.

Examples

Items that won’t fit into full boxes

fx
A
B
C
D
E
1
2
3
4
5
6
7
Product
Units
Fit in a box
Left over
Mugs
130
24
Notebooks
200
50
Pens
1010
100
T-shirts
75
20
Sheet1

Details

MOD divides the first number by the second and returns what’s left. =MOD(130,24) gives 10: five boxes of 24 hold 120 items, and 10 more are left over.

A common trick: =MOD(A2,2) is 0 for even numbers and 1 for odd ones. It’s a handy way to split a list into two groups.

Common mistakes

  • Arguments swapped: =MOD(24,130) returns 24, because 24 is less than 130.
  • The divisor is zero or an empty cell: MOD returns #DIV/0!.
  • With negative numbers, the result takes the sign of the divisor: =MOD(-7,3) gives 2, not −1.

See also