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

ArgumentRequired?What it does
numberYesThe number to divide.
divisorYesThe number to divide by.

Examples

Example 1 — Leftover units

After packing boxes of 12, how many units are left?

C2fx=MOD(B2, 12)
ABC
1OrderUnitsLoose units
21001306
31002240
41003491
=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.

Example 3 — Shade every other row

Use this as a conditional formatting rule.

=MOD(ROW(), 2)=0 Explain

Common mistakes

  • #DIV/0! A divisor of 0 has no remainder. Guard with IF when the divisor can be blank.

Notes

Kyle Stott

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.