# When formatting numeric data with rounding, should the total line reflect the total of the rounded data, or the raw, unrounded data?

Consider this scenario: The rounded numbers add up to 195. But the rounded total would only be 193. So which total should you show when showing rounded numbers. The one that matches what is SHOWN (the rounded data) or what is actually true?

• Can I ask why you are rounding? – DarrylGodden Dec 17 '13 at 9:16
• If your data were rounded percentages do you prefer that the sum of all part is above 100% or under 100% ? Think the answer depends how you present data to the user. Most of the time I prefer real values displayed with mask. – ColdCat Dec 17 '13 at 9:20
• You should sum the rounded numbers. Once you decide a certain level of precision, you should stick to that level of precision. – Jørn E. Angeltveit Dec 17 '13 at 11:04
• @JørnE.Angeltveit: I disagree. I think you should present the total to the same precision as the other numbers, but use the real, unrouded data to arrive at the number to present. Otherwise, the precision of the total is actually going to be less than the precision of the other numbers, because you're propagating the error. – André Dec 17 '13 at 12:14
• @André: Did you try this in a spreadsheet like Excel ;-) – Jørn E. Angeltveit Dec 17 '13 at 12:16

I guess one can always find special cases, but in the general case, I would go with rounding the correct sum, not summing the rounded numbers.

The point of rounding is to make a number easier to digest at a glance. And while we are aware that there is a tradeoff due to lost accuracy, we want to keep the accuracy loss as small as possible. If you were to sum up rounded numbers, you will be accumulating an error. This is not what people want. They want their easy-to-digest number to be as close to the true value as possible.

A widespread example of how rounding is handled: take calculators. They can't work well with fractions. Still, if somebody calculates `(2÷3) + (1÷3)`, they want to get 1 and not 0.99999999. Some calculators can do it, others can't, but the point is that users prefer them to work with the real numbers and not the rounded intermittent results.

As for the sum being incorrect: I doubt that people who want to see the rounded sum will spend the cognitive effort for summing the numbers in their head. If they do, they are deep enough in the matter to notice where the inconsistency is coming from. So I don't think they will be confused. Indeed, ColdCat's comment notes a situation which could be potentially much more confusing: the sum of the rounded numbers could fall outside of the actual domain for the numbers.

• Your example is wrong. A rounded version of ´(2÷3)´ would be ´0.6667´, thus adding up to ´1.0000´. – Jørn E. Angeltveit Dec 17 '13 at 11:04
• @JørnE.Angeltveit OK, sorry. I should have thought of a better one, but while I am absolutely sure such examples exist (I remember seeing lots of them back in highschool when I was using a calculator daily), I just can't think of a concrete example right now. – Rumi P. Dec 17 '13 at 11:26
• Ok, just do (1÷3) + (1÷3) + (1÷3) then. – André Dec 17 '13 at 12:15
• @André: Good example. That would be 0.9999 in the "world" of 4 digits. Correct, IMHO, but I see your point... – Jørn E. Angeltveit Dec 17 '13 at 12:27
• @RumiP. It's not that the users will sum up the numbers, it's that they have other dashboards and indicators that give the aggregated value, so they KNOW what the total value should be. Their checks an balances will not agree. But I think I agree with you that you should sum the real numbers and round the total to arrive at your aggregate value. – richard Dec 17 '13 at 21:29

There are extraordinary cases when a summary of rounded values actually could be used (like calculating the number of containers you need to ship a variety of substances where some substances need won't fit in one container and you can't mix), but that's a special case. And here the volume of all substances and the number of containers can't really be related to each other, and is therefore very different from a price table like the one you depicted in the OP.

Apart from a case such as that always go with the actual value when collecting a sum. Summarizing already rounded values won't tell you anything and is therefore bias output which isn't doesn't relate to reality.

You need to look at the context of what type of values you're handling. And looking at the example above I see only problems with adding a summary of the rounded values.

• I believe you are wrong. Mathematically, at least. Rounded numbers should be used. That's why we have different rounding methods: to take into account the situations where it is used. Eg. "Bankers' rounding" where you round 1.5 to 2 and 2.5 to 2. This will ensure that the sum (and thus the average) is less biased by the rounding. – Jørn E. Angeltveit Dec 17 '13 at 12:12
• @JørnE.Angeltveit Less biased than round half up yes, but in no way less biased than summarizing the true values before doing any rounding. Bankers' rounding and other rounding strategies are convenient in some areas, because treating individual values without rounding them would not be possible. But in a scenario where you have a series of items, each with a associated value, and in that scenario you can look at either the value of one item at a time or at a summation of the values. Then showing a summation of the rounded values together with a summation of the true values will be misleading. – AndroidHustle Dec 17 '13 at 12:31
• OK. I rest my case. I've been down this road before :-P – Jørn E. Angeltveit Dec 17 '13 at 12:37
• @JørnE.Angeltveit haha, OK I get your point... I'm sure you are correct in the context you're imagining. But in the context I'm imagining rounding up the values before doing a summary will produce a false result, it's all in the matter of which context the procedure takes place. I do actually have a master's degree in science, and have a bunch of mathematics theory behind me so my reasoning is not totally grabbed from the air, I assure you. :-) – AndroidHustle Dec 17 '13 at 12:56
• Exactly ;-) Context matters in this case! Never doubted you maths skills (hey, you're a man with 10K respect :-P). I've been trough a few math-cources myself, btw. – Jørn E. Angeltveit Dec 17 '13 at 13:31

Some spreadsheet software provides you the option to perform calculations on the displayed precision. In Excel, it's under the Options pane (behind File), Advanced, `When calculating this workbook`, select `Set precision as displayed`. (More details here).

This is only very rarely what you want--generally when you're only presenting information to people who will object to the seeming contradiction, rather than when you're making data-driven decisions based on the underlying numbers.

You should review the concept of significant digits/figures if you're unsure of what accuracy to use for the sum itself.

unless otherwise indicated, calculations should be performed using the non-rounded numbers when possible. to quote wikipedia. . .

for intermediate results; keep as many digits as is practical (at least 1 more than implied by the precision of the final result) until the end of calculation to avoid cumulative rounding errors.

http://en.wikipedia.org/wiki/Significant_figures

but user preference trumps standard practice, so if the users want to sum the rounded numbers then do so.

I actually had to deal with this very issue at work. When we calculate the VAT on the each line item - we display at 2dp. However, when looking at the grand-total do we add up each line item (which is at 2dp) or add up the unrounded figures.

See these examples:  There is a reasonable expectation of either outcome: that (1) occurs and the sum is equal the sum of the displayed values; or that (2) occurs and the sum is completely accurate.

Solution

The solution is actually a mixture of business decision and UX. In this case the business decided to make sum completely accurate as per (2) and we made it clear to the users/customers that the VAT and Gross values were displayed to 2dp. (I.e. £0.20 could really be any value between £0.195 and £0.20499)

You should show that total which will be practically used. If you are going to bill 193.38 then 195 has no meaning. But if for example in your country there is no coins and/or taxes are paid for rounded costs you will use 195 to bill. So choose only one total which has real meaning and don't show another because it causes misleading. In case you really need both values for practical usage - highlight the most useful one.