Function guides ยท Math

MOD function

Returns the remainder after one number is divided by another.

Syntax

=MOD(number, divisor)
ArgumentWhat it is
numberThe number to divide.
divisorThe number to divide by. It cannot be 0.

What MOD does

MOD returns what is left over after one number is divided by another. MOD(10,3) is 1, because 3 goes into 10 three times with 1 remaining.

It is the function for anything cyclical. Odd and even rows, every fifth line, the day of a repeating schedule, the cents left over after splitting a bill: each is a remainder.

Paired with INT, which gives the number of whole divisions, MOD gives you a complete picture of a division with no decimals.

Two practical notes. First, the divisor is the cycle length, and the answer runs from 0 up to one less than the divisor. A zero-based cycle of 7 gives 0 to 6, so add 1 when you want 1 to 7. Second, MOD is exact on whole numbers but can show tiny errors on decimals, which matters if you test the result against 0. For money, work in cents or round the inputs first.

Outside tasks, MOD is how timetables repeat, how check digits are calculated, and how a long list is dealt into teams one row at a time.

A handy fact: MOD(n,1) returns the decimal part of a positive number, and MOD(n,10) the last digit. Both are quick ways to peel numbers apart.

Because MOD works on the sign of the divisor, MOD(-1,7) is 6, which is useful when you want a count to wrap backward around a week or a schedule. Spreadsheets that rotate a roster use exactly this: subtract a number of days, then wrap the result with MOD so it never goes below zero.

MOD examples

1. Leftover items after packing

Leftover items after packing. The formula =MOD(A2,B2) in cell C2 returns 11.
ABC
1ItemsPer box
2471211

47 items packed 12 to a box fill three boxes with 11 left over. MOD returns that remainder.

2. Odd or even

Odd or even. The formula =IF(MOD(A2,2)=0,"Even","Odd") in cell B2 returns Odd.
AB
1Number
21847Odd

A remainder of 0 when dividing by 2 means even. Combined with IF it labels rows. The same idea with a divisor of 3 or 5 picks out every third or fifth item.

3. Days of the week in a repeating cycle

Days of the week in a repeating cycle. The formula =MOD(A2,7) in cell B2 returns 3.
AB
1Day number
2103

MOD wraps a count around a cycle. Day 10 of a 7-day cycle is day 3. This is how rotating schedules and repeating patterns are built.

Common MOD mistakes

  • Dividing by zero. =MOD(5,0) returns #DIV/0!. Check the divisor first.
  • Expecting the sign of the number. The result takes the sign of the divisor. MOD(-7,3) is 2, not -1.
  • Using MOD on decimals without care. MOD(5.5,2) is 1.5, which is correct, but floating point can leave tiny errors. Round if you compare to a clean number.

MOD on Excel job tests

Remainder tasks come in three flavors. Leftover items after packing: MOD(47,12). Alternating rows: shade every other row with the conditional formatting rule =MOD(ROW(),2)=0. Rotation: assign people to four teams in turn with =MOD(ROW()-2,4)+1 copied down from row 2.

If the task wants both the number of full groups and the leftover, INT and MOD are the matched pair. Check one row by hand to confirm the remainder before filling down.

MOD questions

What does MOD return?
The remainder after dividing the number by the divisor.
How do I check whether a number is even?
=MOD(A2,2)=0 is TRUE for even numbers.
How do I shade every other row?
Use a conditional formatting formula rule such as =MOD(ROW(),2)=0.
What does MOD do with negative numbers?
The result has the same sign as the divisor, so MOD(-7,3) returns 2.

Practice MOD

No lesson is built around MOD yet. The closest thing to practice is a free 5-item sample test, which uses the same kind of formulas in a working grid. The Everyday Excel track shows what is published.

Try a 5-item Excel test sample