Skip to main content
Math & StatsIntermediate LevelIntermediate Excel (Lookups & Business Analytics)

How to Use MOD in Excel

Returns the remainder after division — the standard trick for alternating row colours, shift patterns and even/odd checks.

Direct Answer (Quick Summary)

What is MOD in Microsoft Excel?

MOD divides one number by another and gives you what is left over. It returns #DIV/0! when the divisor is zero. In practice it is used for patterns: MOD(ROW(),2) tells you whether a row is odd or even, which drives banded formatting and alternating shift rosters.

Pro Tip: MOD always returns a result with the same sign as the divisor, which is why MOD(-1,3) is 2 in Excel. That makes it safe for wrapping indexes back into a list.

Formula Syntax

=MOD(number, divisor)

Arguments Breakdown

ArgumentRequirementPurpose & Details
numberRequiredThe value being divided.
divisorRequiredThe number to divide by. Cannot be zero.

When to Use MOD (Real-World Business Scenarios)

  • 1

    Alternating row shading with conditional formatting: =MOD(ROW(),2)=0.

  • 2

    Building repeating cycles such as a 3-shift roster or every-4th-week schedule.

  • 3

    Testing whether a number is even or odd with =MOD(A2,2)=0.

Step-by-Step Practical Business Example

Suppose you have the following dataset in Excel cells A1:D4:

RowValueRemainder
1171
2240
3311
Applied Formula:Result: 1
=MOD(B2,4)

How it works: 17 divided by 4 is 4 with 1 left over, so MOD returns 1. A remainder of 0 means the value divides evenly.

Common Errors & How to Fix Them

#DIV/0!

Why it happens: The divisor is zero or points to an empty cell.

Fix: Guard the divisor: =IF(C2=0,"",MOD(B2,C2)) or ensure the divisor column is populated.

Negative remainder

Why it happens: The number is negative, and Excel follows the sign of the divisor rather than the number.

Fix: Use =MOD(ABS(B2),C2) if you only care about magnitude, or =B2-C2*INT(B2/C2) for a sign-preserving remainder.

Interactive Formula Lab

Try MOD Live in Your Browser

No need to launch desktop Excel. Practice formulas with real-time feedback in our HyperFormula sandbox.

Open Practice Lab

Frequently Asked Questions (MOD)

What does the MOD formula do in Excel?

MOD divides one number by another and gives you what is left over. It returns #DIV/0! when the divisor is zero. In practice it is used for patterns: MOD(ROW(),2) tells you whether a row is odd or even, which drives banded formatting and alternating shift rosters.

What is the syntax for MOD?
=MOD(number, divisor)
What are common mistakes when using MOD?

#DIV/0!: The divisor is zero or points to an empty cell. (Guard the divisor: =IF(C2=0,"",MOD(B2,C2)) or ensure the divisor column is populated.) Negative remainder: The number is negative, and Excel follows the sign of the divisor rather than the number. (Use =MOD(ABS(B2),C2) if you only care about magnitude, or =B2-C2*INT(B2/C2) for a sign-preserving remainder.)

Keep building your formula toolkit with these math & stats functions.

Browse all 41 Excel formulas
Ready to Master Microsoft Excel?

Master MOD in Intermediate Excel

Learn MOD along with our formula library, practice files, and verifiable certificates in our complete curriculum.

Strictly necessary