Modulo Function Excel

There are two ways to “modulo function excel”: the quick way you copy and the durable way you understand. This page gives you both. The exact Excel answer is above; below, we build the small mental model that makes the fix stick, so the next variation of the same problem solves itself.

Exact answer

In Excel: use =MOD(number, divisor) — it returns the remainder after division, so =MOD(17, 5) returns 2.

Syntax

=MOD(number, divisor)

Arguments

ArgumentDescription
numberrequiredThe value to divide.
divisorrequiredWhat to divide by. Zero returns #DIV/0!.

Related functions

INTQUOTIENTROUNDUP
Annotated stepsExcel
1

Select the cell for the remainder and type =MOD(.

2

Select the total, type a comma, then enter the divisor.

3

Press Enter. Pair it with =INT(total/divisor) to get the whole-unit half of the same split.

4

For row banding, use it inside a conditional-formatting formula rule rather than in a cell.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

Need it as an auditable file?

Ships inside the linked template — formula-driven, unlocked, audit-ready.

View template

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!. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. For “modulo function excel”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected formula change, and only then apply the same setup to the full sheet. 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. That is what makes a calculation you can defend to a CFO or an auditor useful in real work: repeatable, auditable, and not dependent on memory or luck.

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. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.

In Google Sheets

Google Sheets handles this almost identically to Excel. The formula syntax above is the same, and the menu lives under a slightly different label rather than a ribbon tab. Use the platform toggle at the top of the page to switch every keyboard shortcut between Windows and Mac, and expect at most cosmetic differences in naming. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Here is the takeaway for “modulo function excel”: copy the answer if you are busy, but if you have a spare few minutes, rebuild the example in Excel yourself with the tool above open beside it. That single pass — type it, run it, watch the result move when you change an input — is what turns a formula you found into a technique you trust. Keep your inputs labelled and referenced, never hard-coded, and the same sheet stays correct and auditable as it grows. Done that way, you will not need to look this up again, and you will be the person others ask.

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

  • modulo formula excel