ROUND
Use the ROUND function to round a number to a specified number of digits
Use
ROUND( number, num_digits )
Rounds a number to a specified number of digits.
| Parameter | Required | Description |
|---|---|---|
| number | Yes | the number to round |
| num_digits | Yes | the number of digits to round number |
| Returns | Number |
Examples
Calculating Reimbursable Mileage
In workflows such as expense claims, calculations often result in fractional amounts that exceed standard currency formats. You can use ROUND in a Variable Update or Input Mapping formula to ensure financial data is clean.
- Scenario: You need to calculate a travel reimbursement by multiplying a distance (from a trigger) by a set rate (stored as a constant), then adding a fixed variable fee.
- Formula:
ROUND(@MyTrigger.out.Mileage * #Cvalue + $Vvalue, 2). - Logic:
2: By setting the num_digits to 2, the function ensures the result is rounded to the nearest cent.- Result: If the raw calculation results in 10.556, the function will return 10.56, which is appropriate for a currency display on an Activity form.
Standardizing Approval Scores
You can assign a numerical score to an End step to help measure or compare approval results. If these scores are generated through averages or percentages, the ROUND function can simplify the data for the run history.
- Scenario: A workflow calculates a final performance score based on several review activities. You want to store this in a variable called
$FinalScorebut prefer a whole number rather than a complex decimal. - Formula:
ROUND($RawScoreAverage, 0). - Logic:
0: Setting num_digits to 0 rounds the number to the nearest whole integer.- Result: If the average score calculated is 87.7, the function will round it to 88. This provides a concise "Score" for reporting purposes.
Pro Tip: It is important to distinguish ROUND from the INT function. While INT simply removes the decimal portion to return the nearest whole number (rounding down), ROUND follows standard mathematical rules, rounding up if the next digit is 5 or higher.