ShareYourGroupShareYourGroupExcel Formulas

Math functions

MOD function in Excel

MOD returns the remainder after one number is divided by another.

Divide 20 by 12 and you get 1 with 8 left over. MOD gives you the 8. A remainder sounds like a small thing, but it is the key to anything that repeats in a cycle: every second row, every third item, days of the week, hours on a clock.

Syntax

=MOD(number, divisor)
ArgumentWhat it is
numberThe number to divide.
divisorThe number to divide by.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: Twelve sales made by four salespeople in three regions.
ABCDEF
1DateSalespersonRegionProductUnitsAmount
205-Jan-2026AshaNorthNotebook201200
312-Jan-2026RaviSouthPen50500
420-Jan-2026MeenaNorthBag43000
502-Feb-2026AshaEastPen30300
614-Feb-2026KabirSouthNotebook15900
728-Feb-2026RaviNorthBag21500
803-Mar-2026MeenaEastNotebook402400
915-Mar-2026AshaNorthBag32250
1022-Mar-2026KabirSouthPen60600
1101-Apr-2026RaviEastNotebook251500
1218-Apr-2026MeenaNorthPen80800
1306-May-2026AshaSouthBag53750

How it works

MOD divides the number by the divisor and returns what is left after taking out as many whole divisors as possible. The result always lies between 0 and the divisor. When the number divides exactly, the result is 0.

Uses

Even or odd. =MOD(A1,2) is 0 for even numbers and 1 for odd numbers.

Every nth row. =MOD(ROW(),3)=0 is TRUE on every third row. Used as a formula rule in Conditional Formatting, =MOD(ROW(),2)=0 shades alternate rows. Inside SUMPRODUCT it adds every other row.

Hours and minutes. =INT(135/60) gives the hours and =MOD(135,60) the minutes left. The same pattern splits paise from rupees, inches from feet and items from full boxes.

The time part of a date and time. =MOD(A1,1) is the fraction of a day, the time, whatever the date. It is shorter than A1-INT(A1).

Shifts that cross midnight. With a start time in A1 and an end time in B1, =MOD(B1-A1,1) gives the right duration even when the shift ends after midnight, where a plain subtraction would be negative.

Does it divide exactly? =MOD(A1,5)=0 tests whether A1 is a multiple of 5. A leap year test is built from three such checks.

Going round in a loop. To number a long list 1, 2, 3, 1, 2, 3, write =MOD(ROW()-2,3)+1 starting in row 2. This shares people into teams or tasks into a rota.

Negative numbers

The result of MOD always carries the sign of the divisor. =MOD(-7,3) is 2, not -1. Excel takes out whole threes going downwards, which reaches -9, and 2 is what must be added to get back to -7. Many programming languages give -1 here. If your sheet has negative values, test what you get.

Common mistakes

In Google Sheets

MOD is the same in Google Sheets.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.