MOD

MOD(number, divisor)[source]

Returns the remainder after dividing number by divisor.

The MOD function calculates the modulus of a number with respect to a divisor, returning the remainder of the division. For example, if 5 is divided by 3, the remainder is 2. Therefore, MOD(5, 3) = 2. If any input is blank or in an error state, the formula evaluates to an error. If either input is an array, the operation is performed element-wise and an array type is returned.

Parameters:
  • number (Operand | int | float) –

    The value to divide.

    Supported types:

    • INTEGER

    • DECIMAL

    • INTEGER_ARRAY

    • DECIMAL_ARRAY

  • divisor (Operand | int | float) –

    The value to divide by.

    Supported types:

    • INTEGER

    • DECIMAL

    • INTEGER_ARRAY

    • DECIMAL_ARRAY

Return type:

Formula

Returns:

The remainder of the division number % divisor.

Supported types:

  • INTEGER

  • DECIMAL

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

Raises:

ValueError – If either number or divisor is not numeric.

Examples

Basic usage:

MOD(10, 3)
# Returns 1

With arrays:

MOD([10, 20, 30], 7)
# Returns [3, 6, 2]