MOD Function
Returns the remainder after division.
Category
Math & Trig
Available in
All versions, Microsoft 365
Returns
A number
Want to practice MOD in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox
Overview
MOD tells you what's left over: MOD(14, 12) is 2. The result always has the same sign as the divisor.
It's behind many clever formulas — every nth row, odd/even checks, banded rows in conditional formatting and times that cross midnight.
Syntax
=MOD(number, divisor) Explain
Arguments
| Argument | Required? | What it does |
|---|---|---|
| number | Yes | The number to divide. |
| divisor | Yes | The number to divide by. |
Examples
Example 1 — Leftover units
After packing boxes of 12, how many units are left?
C2fx=MOD(B2, 12)
| A | B | C | |
|---|---|---|---|
| 1 | Order | Units | Loose units |
| 2 | 1001 | 30 | 6 |
| 3 | 1002 | 24 | 0 |
| 4 | 1003 | 49 | 1 |
=MOD(B2, 12) Explain
Example 2 — Night shifts that cross midnight
Start 22:00, end 06:00 — a plain subtraction goes negative.
=MOD(B2-A2, 1) Explain
Format as [h]:mm to show 8:00.
Common mistakes
- #DIV/0! A divisor of 0 has no remainder. Guard with IF when the divisor can be blank.
Notes

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.