← All comparisons

MOD vs QUOTIENT: remainder and integer division

Divide 17 by 5 and you get two useful integers: how many times it fits (QUOTIENT → 3) and what's left over (MOD → 2). Together they decompose any division — and MOD's sign convention on negatives trips up everyone arriving from a programming language.

The differences at a glance

MODQUOTIENT
17 and 52 (remainder)3 (how many fit)
-17 and 53 — result takes the DIVISOR's sign (unlike C/JS/Java's -2)-3 (truncates toward zero)
Identityn = divisor × QUOTIENT + ... not always! Use n - MOD(n,d) = floor-multiple insteadPairs with MOD only when signs agree
Classic idiomsEvery-nth-row (MOD(ROW(),n)), cycling indexes, time-of-day from datetime (MOD(A2,1)), overnight shiftsFull boxes/packs from a count, pagination
CompatibilityUniversalUniversal (both executed in every LibreOffice version we test, and in our dated Google Sheets run; Excel per docs)

Which should you use?

Compatibility (Excel for the web, Sheets & LibreOffice executed; desktop Excel per docs)

Both behave identically in every LibreOffice build and in the Google Sheets run we execute (desktop Excel per Microsoft's docs — we do not run desktop Excel), including the negative-number conventions. The spreadsheet MOD-takes-the-divisor's-sign rule matches Python — not C, JavaScript, or Java — so ported formulas involving negative inputs deserve a test case. Excel for the web is a separate application with its own calculation engine, and that one we do execute: all 5 corpus cases for these functions matched the documented values there (recalculated on OneDrive, 2026-09-01); the per-case values are on the individual function pages.

Example formulas

Remainder=MOD(17,5)
Whole units=QUOTIENT(17,5)
Time-of-day from a datetime=MOD(A2,1)

Full per-version details on each function page: MOD · QUOTIENT.

How-to recipes using these functions