We have a formula field that calculates savings percentage. The formula is as below, ROUND((( Total_Saving__c * 100) / Total_balance__c ),2) where total saving is also a formula field, the formula for total saving is as below, Total_balance__c - Required_Amount__c and the total balance is a currency field.

And we are getting the results as follows

Total savings = 287.20

Total balance = 1187.20

Savings percentage = 24.19

But if we do the reverse calculation and calculate 24.19% of 1187.20 on a calculator, the result is 287.18. so there is a difference of 0.2. I am not able to identify the issue in the formula field.


The actual savings percent is 24.19137466307278% (at least as far as my calculator can go), leaving to a difference of 0.0013746630727763%, which leads to a difference of 0.01632, which when rounded to two decimal places results in the difference of 0.02 that you've observed. Never underestimate how even a very small fraction of a percent can result in relatively large rounding errors. If you're using rounding at all, you can almost always expect at least a 1-2 cent difference, no matter how you do the math. That's just how rounding works.

| improve this answer | |
  • True..that's how mathematics works. But Can we do anything about this, as it might lead to further wrong calculations. – Aditya Phadke Jun 21 at 11:45
  • @AdityaPhadke You can't use the rounded percentages in any further calculations, which will magnify the differences even more. You should be able to not use the ROUND function, and set the formula to 2 decimal places for display purposes, then you can use the formula in further calculations without rounding errors. – sfdcfox Jun 21 at 15:20

Actual saving percentage is actually having more than two decimals.

287.20 / 1187.20 = 0.24191374663072776280323450134771 (24.191374663072776280323450134771%)

But your reverse calculation is only taking two decimal places:

24.19% * 1187.20

The difference is:

0.00001374663072776280323450134771 * 1187.20 = 0.01632 (0.02)

Using ROUND() function in your formula is unnecessary because you have the option to specify the number of decimal places for the field.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.