@Modulo (Formula Language)

Returns the remainder of a division operation.

Syntax

@Modulo( number1 ; number2 )

Parameters

number1

Number or number list.

number2

Number or number list. If this is equal to 0, @Modulo returns @ERROR.

Return value

remainder

Number or number list. The remainder of number1 divided by number2. If the parameters are number lists, @Modulo returns a list that is the result of pair-wise computation on the list values. The sign of the result is always the same as the sign of the number1.

Usage

A common use of @Modulo is to determine whether a number is odd or even; if the result of @Modulo(number;2) is 1, the number is odd; if the result is 0, the number is even.

When using this function with a number list, the list concatenation operator takes precedence over any other operators; negative numbers must be enclosed in parentheses.

Examples

  1. This example returns 1.
    @Modulo(4;3)
  2. This example returns 0.
    @Modulo(4;2)
  3. This example returns -2.
    @Modulo((-14);3)
  4. This example returns -1;2;3;-3.
    @Modulo((-4):6:8:(-9);3:4:5:6)
  5. This example returns 1 and 3 in a list.
    @Modulo(5 : 7; 4)