Documentation/Calc Functions/MOD

From The Document Foundation Wiki
Jump to: navigation, search
Other languages:
English

Function name:

MOD

Category:

Mathematical

Summary:

This function returns Dividend modulo Divisor, that is the remainder when Dividend is divided by Divisor.

Syntax:

MOD(Dividend; Divisor)

Returns:

Returns a real number that is the remainder when one number is divided by another.

Arguments:

Dividend is a real number or a reference to the cell containing that number which will be the dividend considered for MOD function. Divisor is a real number or a reference to the cell containing that number

If the Divisor is 0 then the function returns an error value.

Additional details:

  • This function is implemented as Dividend - Divisor * INT(Dividend/Divisor), and this formula gives the result even if the arguments are not integer.
  • The sign of result is the same as Divisor.

Examples:

Formula Description Returns
=MOD(11;2) Remainder of 11/2 1
=MOD(-11;2) Remainder of -11/2. The sign is the same as divisor. 1
=MOD(11;-2) Remainder of 11/-2. The sign is the same as divisor. -1
=MOD(11;-2) Remainder of 11/-2. The sign is the same as divisor. -1
=MOD(-11;-2) Remainder of -11/-2. The sign is the same as divisor. -1
=MOD(11.25;2.5) Remainder of 11.25/2.5 1.25
=MOD(11;0) function returns an error value since Divisor is 0 1.25

Related LibreOffice functions:

QUOTIENT

ODF standard:

Section 6.16.42, part2

Equivalent Excel functions:

MOD