Cellwise

Math function

Excel MOD function

MOD divides one number by another and returns what is left over. Use it to find leftovers after packing, spot odd and even numbers, or repeat a pattern every nth row.

fx=MOD(number, divisor)

Arguments

number
The number to divide.
divisor
The number to divide by. It cannot be 0.

MOD examples

Every result below was calculated live from this sample sheet.

ABCD
1BatchCookiesPer tinShift minutes
2Mon14024475
3Tue9624510
4Wed15524390
  1. fx=MOD(B2,C2)

    Result: 20

    140 cookies fill 5 tins of 24 with 20 left over.

  2. fx=MOD(D2,60)

    Result: 55

    Minutes past the hour: a 475-minute shift is 7 hours and 55 minutes.

  3. fx=IF(MOD(B4,2)=0,"Even","Odd")

    Result: Odd

    A remainder of 0 when dividing by 2 means the number is even.

  4. fx=MOD(-7,3)

    Result: 2

    The result takes the sign of the divisor, so -7 mod 3 is 2, not -1.

How to use MOD

  1. Click an empty cell.
  2. Type =MOD( and the number to divide.
  3. Type a comma and the divisor.
  4. Close the bracket and press Enter.

Common MOD mistakes

Dividing by zero

MOD(x,0) returns #DIV/0!. Check the divisor first, or wrap the formula in IFERROR.

Expecting a negative remainder

Excel gives the result the same sign as the divisor. MOD(-7,3) is 2, which is different from some programming languages.

Wanting the whole-number part

MOD only returns the remainder. Use INT(number/divisor) or QUOTIENT for how many times it fits.

MOD FAQ

What does MOD do in Excel?

It returns the remainder after division. MOD(10,3) is 1, because 3 goes into 10 three times with 1 left over.

How do I check if a number is even in Excel?

Use =MOD(A1,2)=0. It returns TRUE for even numbers. You can also use ISEVEN(A1).

How do I highlight every other row in Excel?

Use conditional formatting with the formula =MOD(ROW(),2)=0. It colors every even-numbered row.

Guides that use MOD

Related functions

Updated 2026-10-31