X
Excel Zero to Hero Interactive Learning Platform
0%
aggregation

MOD Function

beginner

MOD Function

🎯Purpose

Returns the remainder after a number is divided by a divisor ($\text{number} \pmod{\text{divisor}}$).

Syntax

EXCEL
=MOD(number, divisor)

Arguments Breakdown

Argument Required? Description
number Required The number for which you want to find the remainder (dividend).
divisor Required The number by which you want to divide (must be non-zero).

Practical Examples

1. Remainder Calculation Drill

From Formulas_&_Functions_Part_1.xlsx:

EXCEL
=MOD(30, 4)

Result: 2 (since $4 \times 7 = 28$, and $30 - 28 = 2$).

2. Alternating Row Shading (Zebra Striping)

In Conditional Formatting rules, highlight every even row:

EXCEL
=MOD(ROW(), 2) = 0

Highlight every 5th row:

EXCEL
=MOD(ROW(), 5) = 0

3. Extracting Time from a Date-Time Serial

In Excel, dates are whole integers and times are fractional decimals. To extract just the time:

EXCEL
=MOD(DateTimeCell, 1)

Gotchas & Behavior

  • If divisor is 0, MOD returns the #DIV/0! error.
  • Sign behavior: The result of MOD takes the sign of the divisor, not the number (e.g., =MOD(-3, 2) returns 1).

Related Knowledge

← Back to Formula Library