MODULUS

This function divides the two arguments passed and returns the remainder of the division. It differs from the Mod function of Excel, in the way the remainder is calculated.

Syntax

= MODULUS(dividend, divisor)

Parameters

Dividend

A number which is being divided. The number can be specified as an integer (e.g., 37), as a decimal value (e.g., 37.48), as a string, or as the value of a variable (e.g, UnitPrice).

Divisor

A number which divides. The number can be specified as an integer (e.g., 37), as a decimal value (e.g., 37.48), as a string, or as the value of a variable (e.g, UnitPrice).

Return Type

Decimal number.

In the case of an error, the function displays an error message: “MODULUS (dividend, divisor): Error message”

The function can be used in combination with other functions.

Examples

Example

Returns

= MODULUS(-3.75, 2)

-1.75

= MODULUS(-3, -2)

-1

= MODULUS(“$3”, 2)

1

= MODULUS(ExtendedPrice, Quantity)

The remainder value of the division

= MODULUS(2, 0)

Displays message “MODULUS(2, 0): Attempted to divide by zero.”

= MODULUS(FLOOR(UnitPrice), 2)

The remainder of division between the floor value of UnitPrice and the number 2.

= ABS(MODULUS(UnitPrice, 2))

The absolute value of the remainder got by division on floor value of UnitPrice by the number 2.