Mod()

Returns the remainder after dividing the first parameter by the second parameter.

Syntax 

Mod(dividend, divisor)

The Mod() function has two parameters:

  • dividend (number): Required. The initial number.
  • divisor (number): Required. The number to divide the dividend by.

Usage 

To use this function, pass it two numbers. The numbers can be positive or negative integer or decimal numbers.

%%=Mod(500,12)=%%

The function returns the modulus of the two numbers: 8 (500 divided by 12 is 41 with a remainder of 8).

This function also works with decimal and negative numbers.

%%=Mod(-500.123,12.456)=%%

This example returns the remainder: -1.88300000000001.