How to Use MOD Function in Excel: Syntax and Examples
In Excel, use the
MOD function to find the remainder after dividing one number by another. The formula is =MOD(number, divisor), where number is the value to divide and divisor is the number you divide by.Syntax
The MOD function has two parts:
- number: The number you want to divide.
- divisor: The number you divide by.
The function returns the remainder after division.
excel
=MOD(number, divisor)
Example
This example shows how to find the remainder when 17 is divided by 5.
excel
=MOD(17, 5)
Output
2
Common Pitfalls
Common mistakes include:
- Using zero as the divisor, which causes an error.
- Confusing
MODwith division or remainder operators in other programs. - For negative numbers,
MODreturns a positive remainder, which may differ from some programming languages.
excel
=MOD(10, 0) // Causes #DIV/0! error =MOD(-10, 3) // Returns 2, not -1
Output
#DIV/0!
2
Quick Reference
| Term | Description |
|---|---|
| number | The value to divide |
| divisor | The number to divide by |
| Result | Remainder after division |
| Error | Divisor cannot be zero |
Key Takeaways
Use =MOD(number, divisor) to get the remainder after division in Excel.
The divisor cannot be zero or Excel will show an error.
MOD always returns a positive remainder, even for negative numbers.
MOD is useful for tasks like checking if a number is even or odd.
Remember MOD differs from division; it only returns the remainder.