In Excel: use =MOD(number, divisor) — it returns the remainder after division, so =MOD(17, 5) returns 2.
Syntax
Arguments
| Argument | Description | |
|---|---|---|
number | required | The value to divide. |
divisor | required | What to divide by. Zero returns #DIV/0!. |
Related functions
Select the cell for the remainder and type =MOD(.
Select the total, type a comma, then enter the divisor.
Press Enter. Pair it with =INT(total/divisor) to get the whole-unit half of the same split.
For row banding, use it inside a conditional-formatting formula rule rather than in a cell.
Need it as an auditable file?
Ships inside the linked template — formula-driven, unlocked, audit-ready.
What this does
MOD returns what is left after dividing. Two uses dominate in practice: extracting a remainder alongside INT (minutes left over after whole hours, items left over after full boxes), and testing for a repeating pattern. =MOD(ROW(), 2)=0 is true on every even row, which is the standard conditional-formatting rule for banding a table. Its result takes the sign of the divisor, not the dividend, which surprises people coming from other languages: =MOD(-1, 3) returns 2 in Excel. A divisor of zero returns #DIV/0!. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “excel mod function”. Start on a copy or a tiny sample, keep the affected formula visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a calculation you can defend to a CFO or an auditor, but the practical win is that someone else can open the file and understand what happened without asking you.
A worked example
After =INT(197/60) gives 3 whole hours, =MOD(197, 60) returns the leftover 17 minutes. To shade every third row, apply a conditional-formatting rule of =MOD(ROW(),3)=0. To test whether a quantity divides evenly into cases of 12, =MOD(A2,12)=0 returns TRUE only when there is no partial case. MOD is the one function that answers both "what is left over" and "is this the nth item", which covers remainders, cycles and every alternating-format rule. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.
In Google Sheets
Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. The short version of “excel mod function”: the answer is at the top of this page, the tool proves it on your own numbers, and the sections above explain why it holds so the next variation does not stump you. Excel rewards people who reference cells instead of typing values and who keep inputs separate from formulas, because that is what makes a result you can audit months later. Build it once, deliberately, with the live tool as a check, and you convert a one-off lookup into a reusable skill — which is the whole point of learning the why and not just the what.
Common mistakes
- Expecting a negative result from a negative dividend — MOD takes the sign of the divisor, so
=MOD(-1, 3)is 2, not -1. - A divisor of 0, which returns
#DIV/0!. - Using MOD for banded row colours on a real Excel Table, where the built-in banded-rows style already does it and survives sorting.
Frequently asked questions
How do I find the remainder of a division?
=MOD(A2, B2) returns what is left over. =QUOTIENT(A2, B2) returns the whole-number part of the same division.
How do I highlight every other row?
Add a conditional-formatting rule with the formula =MOD(ROW(),2)=0 and set a fill. On an Excel Table, prefer the built-in banded-row style.
Why is MOD(-1, 3) equal to 2?
Excel's MOD follows the divisor's sign, so the result is always between zero and the divisor. Many programming languages instead follow the dividend and would return -1.
Other ways people ask this
This guide also answers
- mod formula excel