Excel MOD Function Guide: Syntax, Formula & Examples
GSheetLab Expert
Author
2026-06-03
Published
Learn how to use the Excel MOD function with formulas, real-world examples, and step-by-step explanations to master remainders, odd/even checks, alternating row styling, and more.
There are hundreds of built-in functions in Microsoft Excel that make calculations easier, automate processes, and help you analyze data more efficiently. The MOD function is one of the most useful mathematical functions for beginners and advanced users alike. The Excel MOD function seems simple on the surface but can be used to solve many types of spreadsheet problems, from finding odd and even numbers to creating advanced formulas and formatting rules.
This ultimate guide covers everything you need to know about the Excel MOD function, including its syntax, practical examples, common mistakes, advanced uses, and FAQs.
What Is the Excel MOD Function?
The MOD function in Excel returns the remainder when a number is divided by another number (the divisor).
For example:
- 10 divided by 3 equals 3 with a remainder of 1.
- The MOD function returns that remainder: 1.
The word "MOD" stands for modulus, a mathematical operation used to find remainders. The MOD function is especially useful for checking odd or even numbers, creating repeating patterns, applying conditional formatting, time calculations, grouping data, rotating schedules, and building advanced formulas.
Excel MOD Function Syntax
The syntax of the MOD function is straightforward:
=MOD(number, divisor)Parameters:
- number: The number you want to divide.
- divisor: The number you want to divide by.
Basic MOD Function Example
Let’s start with a simple example:
=MOD(10, 3)Explanation: 10 divided by 3 equals 3 with a remainder of 1. Therefore, Excel returns 1.
How to Use the MOD Function in Excel
Using the MOD function is simple:
- Open Excel and select a cell.
- Type the formula, e.g., =MOD(15, 4)
- Press Enter.
Result: 3. Because 15 divided by 4 equals 3 with a remainder of 3.
MOD Function with Negative Numbers
The MOD function also works with negative values. By default, the MOD function always returns a result with the same sign as the divisor.
Example with a positive divisor:
=MOD(-10, 3)Result: 2. Since the divisor (3) is positive, the result is positive.
Example with a negative divisor:
=MOD(10, -3)Result: -2. Since the divisor (-3) is negative, the result is negative. Understanding how Excel treats negative denominators is important for financial or engineering calculations.
Common Uses of the Excel MOD Function
The MOD function is far more powerful than most users realize. Here are some of the most pragmatic applications.
1. Check if a Number Is Even or Odd
One of the most common uses of the MOD function is to determine whether a number is odd or even.
To check for an even number (if the remainder is 0 when divided by 2, it is even):
=MOD(A1, 2) = 0To check for an odd number (if the remainder is 1 when divided by 2, it is odd):
=MOD(A1, 2) = 1| Number | Formula | Result |
|---|---|---|
| 8 | =MOD(8, 2) | 0 (Even) |
| 7 | =MOD(7, 2) | 1 (Odd) |
2. Highlight Alternate Rows (Zebra Striping)
You can combine the MOD and ROW functions in conditional formatting to create zebra-striped tables for better readability:
=MOD(ROW(), 2) = 0This formula checks if the current row number is even and highlights it, which helps make large datasets easier to scan and gives reports a professional look.
3. Create Repeating Patterns
You can use MOD to repeat values in cycles. For example, if you want a pattern that cycles through 0, 1, and 2:
=MOD(A1, 3)This is particularly useful for setting up shift rotations, scheduling, group assignments, or recurring categories.
4. Split Data into Groups
Suppose you want to divide employees or items into 4 repeating teams. You can use the ROW function combined with MOD:
=MOD(ROW(), 4) + 1This creates groups (Team 1, Team 2, Team 3, Team 4) that repeat automatically down your worksheet.
5. Time Calculations Across Midnight
Excel handles time as fractions of a 24-hour day. If you try to calculate elapsed time when a shift crosses midnight (e.g., starts at 10:00 PM and ends at 2:00 AM), simple subtraction can return a negative value. Using MOD solves this:
=MOD(End_Time - Start_Time, 1)This ensures Excel always calculates a correct positive time duration regardless of midnight crossings.
MOD Function with Conditional Formatting
Conditional formatting becomes much more powerful when combined with MOD. For example, to highlight every third row, you can use the custom formula option and enter:
=MOD(ROW(), 3) = 0This highlights rows 3, 6, 9, 12, and so on.
Using MOD with the IF Function
The MOD function works perfectly with IF formulas. For example, to print 'Even' or 'Odd' next to a number:
=IF(MOD(A1, 2) = 0, "Even", "Odd")MOD Function vs INT Function
Many users confuse the MOD and INT functions. Here is the difference:
- MOD Function: Returns the remainder. For example, =MOD(17, 5) returns 2.
- INT Function: Returns the integer portion (rounds down to the nearest whole number). For example, =INT(17/5) returns 3.
In mathematical terms, INT gives the quotient and MOD gives the remainder.
Advanced MOD Function Examples
Example 1: Rotating Work Schedules
Suppose employees rotate through 3 shifts. You can calculate the shift rotation using:
=MOD(Day_Number, 3) + 1This yields Shift 1, Shift 2, and Shift 3 in a continuous loop.
Example 2: Dynamic Number Sequences
To create repeating numbering sequences (like 1 to 5) for batch processing, ticket numbering, or inventory labels:
=MOD(ROW() - 1, 5) + 1Example 3: Extracting the Decimal Portion of a Number
To extract only the decimal part of a number, use a divisor of 1:
=MOD(A1, 1)For example, 12.75 becomes 0.75.
Common MOD Function Errors
1. #DIV/0! Error: This occurs when the divisor parameter is zero. Because division by zero is mathematically undefined, Excel returns a division error. Always ensure your divisor is non-zero.
2. Negative Divisor Results: If the divisor is negative, the MOD function returns a negative result. Keep divisors positive to ensure predictable, positive outputs.
Best Practices for Using MOD in Excel
- Keep Divisors Positive: This avoids confusing negative outputs.
- Combine MOD with Other Functions: Leverage functions like IF, ROW, COLUMN, and SUMPRODUCT.
- Test with Sample Data: Always verify your formulas with known values before applying them to large datasets.
Real-World Applications
- Finance: Payment cycles, installment calculations, and periodic reporting.
- HR: Employee shift management and rotation schedules.
- Education: Student grouping and rotation assignments.
- Operations: Inventory batch grouping and workflow automation.
Excel MOD Function Examples Summary
| Formula | Result | Explanation |
|---|---|---|
| =MOD(10, 3) | 1 | Remainder after division (10 ÷ 3 = 3 remainder 1) |
| =MOD(15, 4) | 3 | Remainder after division (15 ÷ 4 = 3 remainder 3) |
| =MOD(8, 2) | 0 | Even number (remainder is 0) |
| =MOD(7, 2) | 1 | Odd number (remainder is 1) |
| =MOD(12.5, 1) | 0.5 | Decimal portion extraction |
| =MOD(-10, 3) | 2 | Negative number example (result matches divisor sign) |
Final Thoughts
The MOD function is one of the most useful math functions you can find in Excel. Simple in its basic purpose—finding remainders—it has myriad applications in data analysis, automation, scheduling, formatting, and complex spreadsheet logic. Mastering MOD will help you build smarter, more dynamic spreadsheets and dashboards.
Frequently Asked Questions
Did you find this helpful? Share it with your team.