The Excel MOD function returns the remainder after one number is divided by another. In Excel the result always takes the sign of the divisor — a key difference from many programming languages.
Syntax
| Argument | Description | |
|---|---|---|
number | Required | The number to be divided (the dividend). |
divisor | Required | The number to divide by. If 0, MOD returns a #DIV/0! error. |
How to use it
MOD gives you what is left over after integer division. =MOD(10,3) is 1 because 10 = 3×3 + 1.
A classic use is testing for even/odd or every-Nth: =MOD(row,2)=0 flags even rows for banded shading. To round to multiples, MOD partners with QUOTIENT, which returns the whole-number part of the same division.
The sign gotcha: Excel's MOD result takes the sign of the divisor, not the dividend. So =MOD(-10,3) returns 2 (not -1). Excel computes number - divisor*INT(number/divisor). If you want a result that follows the dividend instead, compute it from QUOTIENT.
Try it: interactive demo
Pick a MOD example to see the formula and its result.
Practice workbook
Frequently asked questions
Why does MOD(-10,3) return 2 instead of -1?
number - divisor*INT(number/divisor), so with a positive divisor the remainder is always positive. =MOD(-10,3) = 2.How do I test for even or odd with MOD?
=MOD(n,2): it returns 0 for even numbers and 1 for odd. (Excel also has dedicated ISEVEN and ISODD functions.)What happens if the divisor is zero?
How is MOD related to QUOTIENT?
number = divisor*QUOTIENT(number,divisor) + remainder (though MOD's sign convention can differ for negatives).Master functions like this in one day
This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class