Inaccuracy of column sum result

Asked

Viewed 44 times

1

Environment: Excel 2013 Example: When adding the values of a column with 1110 lines, the result obtained is 302,204,548.38 If you add the value of 249,998.78 in row 1111 of the same column, you should get 302,454,547.16 but instead the result is 302,454,547,159999

Can someone help me overcome this inaccuracy? Thanks in advance for the help.

António Jesus

1 answer

2

Look, this isn’t actually a bug, but a feature of how floating point numbers (with decimal places) are stored and operated on the memory of computers.

Since numbers are coded in binary and have a limited accuracy, there are fractional numbers that do not have an exact binary corresponding. When the resulting value of a mathematical operation results in one of these numbers, there appears a difference that would not exist in the "pencil and paper" math in base 10.

A much simpler example than yours would be:

   =1*(0,5-0,4-0,1)

Type this in any Excel cell and you will receive a very small value, but different from 0, which would be expected.

Microsoft has two articles explaining this and suggesting corrections:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.