Puzzle for accountants and other excel users

Got something to say or just want fewer pesky ads? Join us... 😊



Seagull over NZ

Well-known member
Jul 7, 2003
1,607
Bristol
OK, got an odd one for you.

In cell A1 type the value 25.52. In cell B1 type 161.71. In cell C1 type 187.23

Hopefully you will agree that 25.52 plus 161.71 equals 187.23.

Now in cell D1 type the following formula:

=IF(ROUND(+A1+B1-C1,2)=0,C1,+A1)

Basically this is saying that if A1 and B1 added together equal C1, then take C1, else take A1.

Now, if you remove the round function and put in cell E1 the following formula:

=IF(+A1+B1-C1=0,C1,+A1)

So tell me, why do you get 2 different answers when you haven't typed in more than 2 decimal places?

Is this an excel bug??

Sorry its a bit dull but this has caused about 5 professional qualified accountants a right nightmare !!
 




Everest

Me
Jul 5, 2003
20,741
Southwick
Calculators rule.
 




Gritt23

New member
Jul 7, 2003
14,902
Meopham, Kent.
I think it is a bug, as my formulas often seem to do that if I stick an "=0" in there. Change the "=0" to "<0.00001" or some such tiny decimal and it should work ok.
 


Easy 10

Brain dead MUG SHEEP
Jul 5, 2003
62,405
Location Location
I just KNEW you'd be straight onto this Gritty. Moth to the flame.

:lolol:
 








chip

Well-known member
Jul 7, 2003
1,313
Glorious Goodwood
dwayne said:
...definitely an excel bug.

No, not a bug.

Essentially you are testing a floating point number for equality with zero. As this is represented by an exponent and mantissa, it is unlikely that after addition and subtraction the result will be exactly zero due to rounding error (precision) in the representation of the original numbers. The suggestion to test against a small number is wise in this case. The use of round merely converts the floating point number to an integer.

What do you expect from accountants? Not the ability to understand numbers I hope?

These sort of errors have been known to cause fatalities. In Inertial navigation systems, these errors can add up to tens of miles over the course of a long-haul flight. If you studied computing in the 70s or 80s this would be one of the first things you where taught. Hope that helps.
 












Marc

New member
Jul 6, 2003
25,267
I thought it was gonna be something FUNNY, like you put all that forumla in and you gte a picture of a bird wapping her breasts out whilst singing the national anthem for Bolivia!
 








Shropshire Seagull

Well-known member
Nov 5, 2004
8,788
Telford
1066Seagull said:
And that's why I hate Microsoft.

Oh dear .....

Good to hear that "floating Point" and "Mantissa" issue again - I remember that rearing its ugly head on the early 286 PCs in the eighties - oh they were the days (before Windows)
 




clapham_gull

Legacy Fan
Aug 20, 2003
25,876
Decimals cannot be expressed in binary exactly and thus stored in the computers memory exactly.

This problem occurs because of the precision of your computer, which must represent and manipulate numbers in binary. Microsoft Excel compares the exact binary representation of the numbers rather than their decimal equivalents, which are displayed on the screen. Therefore, rounding errors can occur in the binary representation of the numbers that are not evident when comparing the decimal values visually.

The best way round it is to do all your calculations in pence - ie drop the decimal point.
 






clapham_gull

Legacy Fan
Aug 20, 2003
25,876
Woodchip said:
And never ever ever ever ever ever ever ever ever ever try and calculate time with excel. Now there is a headache!!!

Ok if you convert everything to seconds first... :D

Or even frames (25 a second), which I the way I have to use it.
 


Simster

"the man's an arse"
Jul 7, 2003
54,952
Surrey
Actually, I'd say it was a bug in Excel. Sure, that problem is one that exists in all systems - but it has been ironed out in some applications, noteably the Microsoft Calculator application.

I suppose to get round this issue, you can always write your own version of ROUND in VBA...
 


Albion and Premier League latest from Sky Sports


Top