% Operator

Example   See Also

Returns the remainder (modulus) obtained by dividing one numeric expression into another.

Syntax

nDividend % nDivisor

Arguments

nDividend

Specifies the dividend (numeric expression being divided). The number of decimal places in nDividend determines the number of decimal places in the result.

nDivisor

Specifies the divisor (the numeric expression dividing the dividend nDividend). A positive number is returned if nDivisor is positive; a negative number if nDivisor is negative. nDivisor cannot be zero.

Remarks

The modulus operator (%) and MOD( ) return identical results.

The modulus operator (%) is an arithmetic operator. Other arithmetic operators are: + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation). When these operators are combined in a numeric expression, % has the same precedence as * and /.

For a further discussion of operators and their order of precedence, see the Operators topic.