Last updated on November 16th, 2026 at 06:31 pm

The Excel MOD function returns the remainder after division: =MOD(number,divisor). For example, =MOD(17,5) returns 2 because three complete groups of five use 15, leaving two. Both arguments are required. The nonzero result follows the sign of the divisor, which explains the surprises with negative numbers.
In finance work, the useful question is often not “what is the remainder?” It is “has another quarter ended?”, “which rotation does this item belong to?” or “how many hours passed across midnight?” This guide builds those applications from small examples you can check yourself. It also shows when a neat formula can hide a bad assumption.
Excel MOD function syntax and a quick test
Type =MOD(17,5) into an empty cell and press Enter. Excel should show 2. The first argument is the number you divide; the second is the divisor. Some regional Excel settings use a semicolon between arguments instead of a comma. Use the separator your installation expects.
| Formula | Expected result | Reason |
|---|---|---|
| =MOD(17,5) | 2 | 17 = 5 × 3 + 2 |
| =MOD(20,5) | 0 | 20 divides into four complete groups. |
| =MOD(7,2) | 1 | Seven is odd. |
| =MOD(8,2) | 0 | Eight is even. |
| =MOD(6.75,1) | 0.75 | With a positive number, a divisor of one leaves its fractional part. |
The result is a number, not a label saying “remainder”. You can use it inside IF, conditional formatting or another calculation. Before nesting it inside a large model, test the standalone result. A wrong reference becomes much harder to spot once several functions surround it.
Why negative numbers give unexpected MOD results
Excel uses the relationship MOD(n,d)=n-d*INT(n/d). INT rounds down toward negative infinity. It does not simply remove decimal places. That difference becomes important when the quotient is negative.
Take =MOD(-17,5). The quotient is −3.4, and INT(−3.4) is −4. The remainder is therefore −17 − 5 × (−4) = 3. You can check it in reverse: 5 × (−4) + 3 = −17. The result is positive because the divisor is positive.
| Formula | Quotient after INT | Result |
|---|---|---|
| =MOD(-17,5) | −4 | 3 |
| =MOD(17,-5) | −4 | −3 |
| =MOD(-17,-5) | 3 | −2 |
This behaviour follows Microsoft’s MOD specification. Do not assume a programming language’s remainder operator will match Excel for every signed input. If a model moves between Excel and code, include negative-number tests in the reconciliation.
Excel MOD function example: flag every third month
Suppose A2:A13 contains the month numbers 1 to 12. You want a marker after each block of three months. In B2, enter =IF(MOD(A2,3)=0,"Quarter end","") and copy it down. The marker appears at 3, 6, 9 and 12.
However, this is an index-based rule. It does not prove that the dates are calendar quarter ends. If month one in your model is February, the third model month is April. Decide whether the business rule means every third forecast month, a fiscal quarter or a calendar quarter before choosing a formula.
A useful test is to list the expected trigger months by hand, then compare the formula output. For a monthly debt schedule, a one-month shift in a repayment marker can distort closing debt and interest even when the spreadsheet contains no visible error.
Excel MOD function example: create a repeating cycle
Imagine six practice invoices assigned in turn to three fictional reviewers: A, B and C. Put the item index 1 to 6 in column A. The formula =MOD(A2-1,3)+1 produces 1, 2, 3, 1, 2, 3. Map those numbers to the reviewers.
Subtracting one is deliberate: an index of one becomes zero before the remainder is calculated, and adding one restores a human-readable cycle. Without that offset, the order starts at two. Test the first item, the final item in a cycle and the first item in the next cycle.
A rotation is not a workload-balancing algorithm. One complex invoice may require more work than several simple ones. Use this formula for a defined repeating pattern, not as evidence that a team allocation is fair or efficient.
Example 3: highlight alternate rows without changing the data
For a range starting in row 2, select the data cells and create a formula-based conditional-formatting rule using =MOD(ROW()-ROW($A$2),2)=0. The first data row has index zero, so it is highlighted; the next is not. The pattern repeats.
In this case, the anchored starting row keeps the explanation clear. If you want the second data row highlighted instead, test for 1. Use formatting to help the reader follow rows, while leaving the underlying values unchanged. Our Excel gridlines guide explains the separate choice of showing worksheet gridlines.
Excel MOD function for time across midnight
If a fictional shift starts at 22:30 in B2 and ends at 06:15 in C2, =MOD(C2-B2,1) returns the fraction of a day between them across midnight. Format it as [h]:mm to display 7:45. Multiply the result by 24 if you need 7.75 decimal hours.
This works only when you intend an elapsed interval shorter than 24 hours and the clock times are valid. An accidental reversed time can also turn into a plausible positive duration. A job lasting 27 hours would wrap around to three hours if you discard the date information.
For multi-day work, record complete start and end dates with times, then subtract those values directly. Keep the dates rather than forcing every interval into one day. Displaying [h]:mm preserves elapsed hours above 24; a standard clock-time display does not.
MOD versus QUOTIENT, INT and rounding
| Function or operation | Question it answers | Illustration |
|---|---|---|
| MOD | What remainder is left under Excel’s sign convention? | =MOD(17,5) → 2 |
| QUOTIENT | What is the integer portion of a division? | =QUOTIENT(17,5) → 3 |
| INT | What integer lies at or below this value? | =INT(-3.4) → −4 |
| ROUND | What value is nearest at the chosen decimal precision? | =ROUND(3.46,1) → 3.5 |
Therefore, choose the function from the business rule. A full-carton calculation and a rounded sales estimate answer different questions. Also avoid calling MOD a replacement for division: it returns the part left over, not the quotient.
Troubleshooting the Excel MOD function
- #DIV/0!: check whether the divisor is zero or refers to an empty input that becomes zero. Decide what zero means before masking the error.
- Unexpected sign: inspect the divisor and work through the INT identity.
- Unexpected time: check for reversed inputs, missing dates and an interval of 24 hours or more.
- Very small decimal residue: decimal fractions can be affected by floating-point precision. Define a business tolerance or scale a fixed-precision quantity to integers before testing exact equality.
- Wrong cycle: check whether the index starts at zero or one, and whether inserted rows changed the reference.
For example, a currency allocation in paise can use integer units if the source amounts truly have two decimal places. That is a modelling decision, not permission to round away a genuine difference. Keep the original amount, document the precision and reconcile the totals.
A short practice exercise
Build a 12-row monthly schedule with month index, forecast receipts and a quarterly-review flag. Use hypothetical receipts of ₹10,000 each month. Your review flag should trigger four times and the receipt total should remain ₹1,20,000. Then shift the first month’s date and explain whether the trigger dates still match the intended policy.
This tests more than formula recall. You should be able to explain the starting index, reference anchors, expected output and exception cases. For more practice, see our advanced Excel interview questions and financial-model practice files.
Excel MOD function: frequently asked questions
Why is MOD used in Excel?
Use MOD when a rule depends on a remainder or a repeating cycle. Common examples include alternate-row formatting, every-nth-period flags and time wrapping. First establish that the business rule really repeats.
How do you use the MOD formula?
Enter =MOD(number,divisor), or reference cells such as =MOD(A2,B2). Test the divisor for zero and check the expected result with a small example before copying the formula.
Can MOD return a negative number?
Yes. A nonzero result follows the divisor’s sign. For example, =MOD(17,-5) returns −3. A positive divisor does not produce a negative remainder.
Does MOD calculate working hours automatically?
It can wrap a valid clock-time difference across midnight, but it does not determine breaks, overtime rules or multi-day duration. Those require separate inputs and business rules.
A CFA charterholder with hands-on experience across investment analysis and finance education. At MentorMeCareers, he writes and reviews content on CFA, financial modeling, and investment banking careers — grounded in real market data rather than generic advice, and shaped by what actually helps candidates and professionals succeed.

