Download Squad: Excel 2007 can't do math (unless 850 * 77.1 = 100,000)

by Volker Weber

While some members of the Download Squad team may be math whizzes, some are lucky if they can find the Windows calculator. But once it's up and running, we're pretty sure that when you multiply 850 by 77.1, the answer should be 65,535. But for some reason when you perform the same calculation using Microsoft Excel 2007, you get 100,000.

More >

Comments

I've been reading about this since yesterday but only tested it now, it works fine here (using Excel 2003).
Did you try it?

I have to say, it is really surprising that this would get through Q&A. This is one of the classic edge cases (what happens when you get results that are just before, at and just beyond 65,535 and each of the other maxed out sizes).

Vitor, read the headline (or the text) again ;-)

Martin, what exactly is you point? I've read it.

OK, Excel 2007 only :-)

It appears they were trying to fix one problem and created another one.

@Ben: It's not quite that typical overflow. The bug is a lot more obscure. Only multiplying two numbers where at least one is a floating point number causes this. It gets even more obscure: Let's say you have the result in cell A1. If you now enter =A1+1 in A2, A2 will display 100001. However, if you enter =A1*2 in A3, A3 will display 131070. Similarly, =A1/2 will yield 32767,5. =A1*1 will, interestingly, yield 100000... There are more strange behaviors, I I think I saw something about accessing the cell in different ways in VBA yielding different values.

@Vitor: I have tried it in Excel 2007 and for me the bug occurred.

It ist quite understandable, that if you calculate 851*77,1 in cell A1 you get the correct result 64.612,1. If you set B1 to A1-77,1 you'll get - yes you are right ;-): 100.000. The same occurs with 849 and +77,1 ;-)

Quite interesting: saved the file to xls and opened it with numbers. Every thing fine hear, means 65.535.

Frank Mueller, 2007-09-26 13:02

@Thomas - Thanks, I see how that is less likely to get caught.

Out of curiosity, as I don't have Office 2007 here right now, has anybody saved in Open XML and seen whether the two numbers (the value and the representation) differ?

Perhaps MS can convince the ISO to introduce a new standard for mathematic calculations. ;-)

maybe they should a quick-link to google

Samuel Orsenne, 2007-09-26 16:22

maybe they should revisit whatever they have submitted to the IRS ;-)

Armin Roth, 2007-09-27 00:31

@Ben: I have tried it. I am not too familiar with the format, but this is what I found in the worksheet's XML:

<row r="1" spans="1:1">
<c r="A1">
<f>850*77.1</f>
<v>65534.999999999993</v>
</c>
</row>

If there is another place to look, let me know.

Joel Spolsky posted an interesting explanation with some background infos. He says that the bug affects only how the cell is displayed (not any calculations) and only if the number is very close to 65535, not 65535 itself.

@Joel - Yes, it appears to be a "display" issue. Because you can write formulas against the result and they're accurate.

I tried this:

A3 77.1
A4 850
A5 =A3*A4 (result 100000)
A6 =A5*3 (result 196605)

Now everybody, in the voice of Dana Carvey impersonating Johnny Carson, "This is some weird, wild stuff!"

Post a comment











Shall I remember this for you?




Use your full name and a working email address. Unless you want your comment to be removed. No kidding.



Recent comments

Roland Dressler on Outlook to Notes converter: from PST to NSF at 11:50
Karl Heindel on Outlook to Notes converter: from PST to NSF at 10:30
Jerry Preissler on LibreOffice vs Apache OpenOffice at 13:47
Mariano Kamp on How to commit at 09:41
Bernd Vellguth on Outlook to Notes converter: from PST to NSF at 02:05
Thilo Hamberger on Outlook to Notes converter: from PST to NSF at 16:40
Jens Bruntt on Free PlayBook for your Android app submission at 11:47
Karl Heindel on Outlook to Notes converter: from PST to NSF at 20:26
Roland Dressler on Outlook to Notes converter: from PST to NSF at 15:12
Stephan H. Wissel on heise online: IBM plant Stellenabbau in Deutschland at 08:38
Jan Lauer on heise online: IBM plant Stellenabbau in Deutschland at 04:13
Juergen Heinrich on Balance at 03:29
Jörg Hermann on Girls On Longboards at 02:42
Stephan H. Wissel on heise online: IBM plant Stellenabbau in Deutschland at 23:21
Joerg Michael on heise online: IBM plant Stellenabbau in Deutschland at 21:01
Ben Poole on Outlook to Notes converter: from PST to NSF at 19:46
David Hablewitz on BlackBerry Business Cloud Services with Microsoft Office 365 at 16:44
Patrick Picard on RIM tries to be social. Falls flat on face. at 16:00
Volker Weber on Outlook to Notes converter: from PST to NSF at 10:29
Richard Hogan on Outlook to Notes converter: from PST to NSF at 10:26
Joachim Haydecker on Girls On Longboards at 08:26
Karl Heindel on Outlook to Notes converter: from PST to NSF at 07:50
Keith Brooks on Outlook to Notes converter: from PST to NSF at 04:21
David Hablewitz on Outlook to Notes converter: from PST to NSF at 01:38
Karl Heindel on Outlook to Notes converter: from PST to NSF at 22:44

Ceci n'est pas un blog

vowe.net is a personal website published by Volker Weber a.k.a. vowe. I am an author, consultant and systems architect based in Darmstadt, Germany.

rss Click here to subscribe

Hello

About me
Contact
Publications
Certificates
Wishlist
Frequently asked questions

Local time is 11:01

visitors.gif
171 visitors online

Archives

As most of my articles roll off the front page rather quickly, I am making an archive of previous posts available here. You can also use the handy search box at the top of the page if you are looking for something particular.

Last 30 days
More archives

Mobile tag for this page

© 1992-2012 Volker Weber.
All Rights Reserved.

Impressum