REMAINDER( NUM, NUM )

Placeholder Tooltip Replace With
NUM dividend: Number A number value, such as a Number variable, to be divided (a numerator)
NUM   divisor: Number A number value, such as a Number variable, by which to divide (a denominator)

Returns a Number value

The REMAINDER expression returns the remainder of a division. If the denominator is a zero, HotDocs generates a divide by zero error.

In this basic example, HotDocs divides 10 by 3. The remainder of that division is 1:

REMAINDER( 10, 3 )

In this next example, a user enters a time value in number format (such as 6 hours). However, using the REMAINDER expression (as well as TRUNCATE and ROUND), HotDocs causes the value to appear in hours:minutes format:

FORMAT( TRUNCATE ( Number of Hours, 0 ), "9" ) + ":" +

FORMAT( ROUND ( 60 * REMAINDER( Number of Hours, 1 ), 0 ), "09" )

This script takes the value of Number of Hours, which may have a decimal value, and truncates it to a whole number. Then, using the REMAINDER expression, Number of Hours is divided by 1 and the remainder of the division is multiplied by 60 (as in 60 minutes). HotDocs then rounds that value and brings these two values together in a string, separated by a colon. The value is then formatted correctly.