Contact

MOD Function (LibreOffice Calc)

Math Beginner LibreOffice Calc Introduction not established

The MOD function in LibreOffice Calc returns the remainder after division. It is essential for grouping, indexing, periodic patterns, and algorithmic logic. Learn syntax, examples, common errors, and best practices.

Verification status: Consult the documentation, examples and any stated test scope below. How formula examples are checked

Availability and version history

  • Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
  • Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.
The **MOD** function returns the remainder after dividing one number by another in LibreOffice Calc. It is essential for grouping, indexing, periodic patterns, scheduling, and algorithmic logic. `MOD` is one of the most versatile math functions, enabling everything from alternating row colors to cycle detection and bucket grouping.

What the MOD Function Does

  • Returns the remainder after division
  • Works with positive and negative numbers
  • Useful for grouping, indexing, and periodic patterns
  • Works with cell references, formulas, and expressions
  • Integrates with FLOOR, CEILING, INT, and TRUNC

It is designed to be simple, powerful, and universally compatible.

Syntax

MOD(number; divisor)

Arguments

  • number:
    The value to divide.

  • divisor:
    The number to divide by. Must be non‑zero.

Basic Examples

Simple remainder

=MOD(10; 3)

Returns 1.

MOD with a cell reference

=MOD(A1; 5)

Returns the remainder of A1 divided by 5.

Even/odd detection

=MOD(A1; 2)

Returns 0 for even numbers, 1 for odd numbers.

Cycle through values

=MOD(ROW(); 3)

Repeats 0,1,2,0,1,2,…

Advanced Examples

Group values into buckets of 10

=MOD(A1; 10)

Returns the position of A1 within its 10‑value bucket.

Alternating row shading

=MOD(ROW(); 2)

Returns 0/1 pattern for zebra striping.

MOD with negative numbers

=MOD(-10; 3)

Returns 2 (Calc ensures a non‑negative remainder).

MOD for scheduling cycles

=MOD(A1; 7)

Useful for weekly rotation patterns.

MOD for indexing repeating sequences

=INDEX($A$1:$A$3; MOD(ROW()-1; 3)+1)

Cycles through A1, A2, A3 repeatedly.

MOD for time calculations

=MOD(A1; 1/24)

Returns the fractional remainder of time within an hour.

MOD with FLOOR to compute bucket start

=A1 - MOD(A1; 10)

Returns the lower bound of A1’s 10‑value bucket.

Common Errors and Fixes

Err:532 — Division by zero

Occurs when:

  • divisor is zero
  • divisor is an empty cell
  • divisor is text

Fix:
Ensure divisor is a non‑zero numeric value.

MOD returns unexpected results with negative numbers

Cause:

  • Calc returns a non‑negative remainder, even for negative inputs.

Example:
MOD(-10; 3) → 2

MOD returns 0 unexpectedly

Possible causes:

  • number is an exact multiple of divisor
  • number is stored as text
  • divisor is larger than number

Fix:
Convert text to numbers using:
Data → Text to Columns → OK

Best Practices

  • Use MOD for grouping, indexing, and periodic patterns
  • Use MOD with ROW() or COLUMN() for formatting logic
  • Use MOD with FLOOR to compute bucket boundaries
  • Use MOD for cycle detection in scheduling and rotation systems
  • Avoid using MOD with zero or text values
MOD is one of the most powerful “logic‑building” math functions — perfect for cycles, patterns, and grouping.
  • Use FLOOR to compute the lower bound of a bucket
  • Use CEILING to compute the upper bound
  • Use INT for integer division
  • Use TRUNC to remove decimals
  • Use A1 - divisor * INT(A1/divisor) as a manual MOD alternative

By mastering MOD and its combinations with other math functions, you can build elegant, pattern‑driven models in LibreOffice Calc that handle grouping, indexing, and periodic logic with precision.


Reproducible example (tested in LibreOffice Calc)

This standalone example was calculated in LibreOffice Calc 25.2.3.2 and matched the expected value. It is a practical cross-check of one usage, not proof that every example elsewhere on this page is correct.

=MOD(17;5)

Expected result: 2.

Calculate the remainder after division.

If the result differs, check the referenced cells, argument separators and number formatting. For more information, consult the LibreOffice Calc official help.