Excel MOD Function is a mathematical function used to find the remainder when one number is divided by another. It can be a helpful tool for various applications, such as calculating cyclic patterns or distributing items evenly.
Syntax
MOD(number, divisor)
Arguments
number | The numeric value for which you want to find the remainder after division. |
divisor | The numeric value you want to use as the divisor. |
How to Use
To use the Excel MOD function, follow the syntax: MOD(number, divisor). Here are some examples to illustrate its use:
Example 1: Finding the Remainder
1 |
=MOD(17, 5) |
In this example, MOD(17, 5) returns 2 because when you divide 17 by 5, you have a remainder of 2.
Example 2: Handling Negative Numbers
1 |
=MOD(-10, 3) |
Even with negative numbers, MOD(-10, 3) will return 2, as it still calculates the remainder.
Example 3: Handling Fractions
1 |
=MOD(11.5, 3) |
MOD(11.5, 3) returns 2.5, as it can handle decimal numbers and provide the remainder.
Example 4: Handling Zero Divisor
1 |
=MOD(10, 0) |
If you attempt to divide by 0, Excel will return a #NUM! error, as division by zero is undefined.
Example 5: Using MOD in Conditional Formatting
You can use MOD in Excel’s Conditional Formatting to create alternating row colors in a table. For instance:
1 |
=MOD(ROW(), 2) = 0 |
This formula will format every other row with a different color, creating a striped pattern.
Additional Information
MOD is a versatile function for calculating remainders. It can be particularly useful in scenarios like scheduling, where you need to distribute tasks evenly or in cyclic patterns.