MOD( ) function
Syntax
MOD(number, divisor_number)
Parameters
Name | Type | Description |
---|---|---|
number | numeric |
The number to divide. |
divisor_number | numeric |
The number to divide number by. If number or divisor_number, or both, include decimals, the output has the same decimal precision as the input value with the higher number of decimal places. For example, the output for MOD(45.35, 5.3) is "2.95". |
Output
Numeric.
Examples
Basic examples
Returns 3:
MOD(93, 10)
Returns 2.0:
MOD(66, 16.00)
Returns 3.45:
MOD(53.45, 10)
Advanced examples
Calculating an anniversary date
Defines a field that shows the number of months since the last anniversary:
DEFINE FIELD Months_since_last_anniversary COMPUTED MOD(Months_of_service, 12)
Remarks
When to use MOD( )
Use the MOD( ) function to test whether two numbers divide evenly, or to isolate the remainder of a division calculation. This function divides one number by another and returns the remainder.