AnalystPracticeGuides
DashboardSign up

The Excel MOD function

MOD returns the remainder after a division: =MOD(number, divisor). It sounds like school maths, but it solves real spreadsheet tasks: even or odd checks, every nth row and times that cross midnight.

What does MOD return?

FormulaResult
=MOD(10,3)1
=MOD(12,4)0
=MOD(-3,5)2

With a negative number, the result has the sign of the divisor.

How do you test even or odd?

=IF(MOD(A2,2)=0,"Even","Odd")

ISEVEN and ISODD do the same in one step.

How do you mark every third row?

=MOD(ROW(),3)=0

Use it in conditional formatting to shade every third row, or as a filter to sample rows.

How do you calculate hours across midnight?

A shift from 22:00 to 06:00 gives a negative result with =B2-A2. MOD fixes it:

=MOD(B2-A2,1)

Format the result as time to see 8:00.

Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise MOD, ODD, EVEN

Updated November 2026.

← All free guides