MOD function
Quick answer
MOD returns the remainder after dividing one number by another.
- Syntax
=MOD(number, divisor)- Most common use
=MOD(A2,B2)returns 1 (Remainder 1 when divided by 2, so 17 is odd)
It answers questions like "how many units are left after filling full cases?", "is this number odd?" and "is this every third row?". The result always has the same sign as the divisor.
- Available in
- Every current version
- Category
- Math functions
- Returns
- The remainder, with the same sign as divisor.
- Google Sheets
- Works the same in Google Sheets.
Syntax
=MOD(number, divisor)
| Argument | Required? | What it is |
|---|---|---|
number | Required | The number to divide. |
divisor | Required | The number to divide by. It can't be 0. |
Examples
Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.
| Cell | Formula | Result | What it shows |
|---|---|---|---|
| C2 | =MOD(A2,B2) | 1 | Remainder 1 when divided by 2, so 17 is odd |
| C3 | =MOD(A3,B3) | 10 | Units left after filling cases of 24: 10 |
| C4 | =MOD(A4,B4) | 2 | The result takes the divisor's sign: -7 mod 3 is 2, not -1 |
Try it live
This is the sample sheet. Change any number or text, or edit a formula, and the results update.
Show the sample data as a table
| Value | Divisor | Remainder |
| 17 | 2 | 1 |
| 130 | 24 | 10 |
| -7 | 3 | 2 |
Practice MOD
Graded instantly, then re-checked on changed data.
Loose units
D2, use MOD to find how many loose units each product has. Fill down to D6.Common mistakes
| What you see | Why, and how to fix it |
|---|---|
| #DIV/0! | The divisor is 0 or an empty cell. Check the second argument. |
| Unexpected result with negative numbers | MOD follows the sign of the divisor, so MOD(-7,3) is 2. Use =A2-TRUNC(A2/B2)*B2 for a remainder that follows the number's sign. |
| Tiny decimals instead of 0 | Dividing decimals can leave rounding noise such as 1E-16. Wrap the result in ROUND(…,10) before testing it. |
Tips
- Shade every other row with a conditional formatting rule: =MOD(ROW(),2)=0.
- Get just the time from a date-time with =MOD(A2,1).
Questions
How do I check if a number is even in Excel?
Use =MOD(A2,2)=0, which returns TRUE for even numbers. ISEVEN(A2) does the same.
What does MOD do in Excel?
It returns the remainder after division: =MOD(10,3) is 1 because 3 goes into 10 three times with 1 left over.
How do I get the whole number and remainder separately?
Use =INT(A2/B2) for the whole part and =MOD(A2,B2) for what's left.
Answers that use MOD
In other languages
MOD is RESIDUO in Spanish Excel and REST in German Excel. Each page has the syntax with semicolons, the examples and the exercise in that language. For other functions and languages, use the Function Translator.
Updated Checked by running: every formula on this page was run by our formula engine on .