How can I round the result of a formula to 2 decimal places?

#### Question:

How can I round the result of a formula to 2 decimal places?

#### Answer:

You can use the Round function. It takes 2 inputs, the 1st is the number to be rounded and the 2nd input is the number of decimal places. For example:

ROUND(0.66666,3) = 0.667

ROUND(0.66666,0) = 1

#### More information:

If you use Round in formulas and then do calculations on the rounded values then you could introduce errors from the rounding. For example:

If you calculated the difference between 3 time periods, each 20 minutes long, and rounded to 2 decimal places, then each would be 0.33.

If you then get a total of the 3 rounded times, you would get 0.99 hours instead of 1 hour.

**To avoid compounding rounding errors:**

One approach is to *hide* the calculation formula (via its settings) and then:

- Add a 2nd formula field below it that takes the result and rounds it, and displays that to the user. Also, use its merge field in the template's DOCX.
- Ensure that subsequent formulas reference the original (hidden) formula that does the calculation, rather than the rounded result.

An alternative approach is to only round numbers inside the template's DOCX by modifying merge fields with formatting switches that affect the way they display. In that case the numbers are not rounded by the mobile device, they are rounded only in the output PDF (thus rounding errors never get compounded during calculations). That method is described at https://support.office.com/en-us/article/Insert-fields-in-Word-c429bbb0-8669-48a7-bd24-bab6ba6b06bb in section “Display the field results” as illustrated below:

## Comments

0 comments

Please sign in to leave a comment.