<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Getting IT Right - the unofficial voice of Meteor IT &#187; calculation</title>
	<atom:link href="http://blog.meteorit.co.uk/tag/calculation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.meteorit.co.uk</link>
	<description>Ramblings of a self-confessed geek</description>
	<lastBuildDate>Tue, 02 Feb 2010 22:19:29 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='blog.meteorit.co.uk' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/f20aaf2e5a61cd42fe07e67a0f2a1c3f?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Getting IT Right - the unofficial voice of Meteor IT &#187; calculation</title>
		<link>http://blog.meteorit.co.uk</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.meteorit.co.uk/osd.xml" title="Getting IT Right &#8211; the unofficial voice of Meteor IT" />
	<atom:link rel='hub' href='http://blog.meteorit.co.uk/?pushpress=hub'/>
		<item>
		<title>Excel 2007 calculation bug fix released after two weeks</title>
		<link>http://blog.meteorit.co.uk/2007/10/10/excel-2007-calculation-bug-fix-released-after-two-weeks/</link>
		<comments>http://blog.meteorit.co.uk/2007/10/10/excel-2007-calculation-bug-fix-released-after-two-weeks/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 10:43:33 +0000</pubDate>
		<dc:creator>Adam Vero</dc:creator>
				<category><![CDATA[Office System]]></category>
		<category><![CDATA[Patching + hotfixes]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[hotfix]]></category>

		<guid isPermaLink="false">http://veroblog.wordpress.com/2007/10/10/excel-2007-calculation-bug-fix-released-after-two-weeks/</guid>
		<description><![CDATA[A fix for the Excel 2007 calculation bug affecting results around 65535 and 65536 has been released in the last few hours. The Excel team blog post says:
As of today, fixes for this issue in Excel 2007 and Excel Services 2007 are available for download&#8230;We are in the process of adding this fix to Microsoft [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.meteorit.co.uk&blog=646149&post=128&subd=veroblog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>A fix for the <a title="Excel 2007 displays wrong value answers to some calculations" href="http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/" target="_blank">Excel 2007 calculation bug affecting results around 65535 and 65536</a> has been released in the last few hours. The <a title="Excel team announce bug fix" href="http://blogs.msdn.com/excel/archive/2007/10/09/calculation-issue-update-fix-available.aspx" target="_blank">Excel team blog post</a> says:</p>
<blockquote><p>As of today, fixes for this issue in Excel 2007 and Excel Services 2007 are available for download&#8230;We are in the process of adding this fix to Microsoft Update so that it will get automatically pushed to users running Excel 2007 or Excel Services 2007.&nbsp; Additionally, the fix will also be contained in the first service pack of Office 2007 when it is released (the release date for SP1 of Office 2007 has not been finalized).</p>
</blockquote>
<p><a title="MS KB943075 - Excel 2007 calculation bug hotfix" href="http://support.microsoft.com/kb/943075" target="_blank">Microsoft knowledgebase article KB943075</a> discusses the fix and gives the usual details for what versions and sizes the updated files should have after the fix. The version number of Excel.exe is altered from 12.0.6024.5000 to 12.0.6042.5000. Now read that again &#8211; yes, easy to miss the difference from &#8216;24&#8242; to &#8216;42&#8242; if you look too quickly. (NB: you may have a different version, mine is at 12.0.6024 after installing the <a title="MS security update for Excel ms07-036" href="http://www.microsoft.com/technet/security/bulletin/ms07-036.mspx" target="_blank">security update</a> as per <a title="KB936509" href="http://support.microsoft.com/kb/936509" target="_blank">KB936509</a>, as far as I can tell.)</p>
<p>The <a title="Download Excel calculation bug hotfix" href="http://download.microsoft.com/download/6/1/3/61343075-aa12-4152-a761-fccc16d6cef4/office-kb943075-fullfile-x86-glb.exe" target="_blank">download for the fix for Excel 2007</a> (33Mb exe file) is linked from the Excel team blog as well as from the KB article. The <a title="Excel team announce bug fix" href="http://blogs.msdn.com/excel/archive/2007/10/09/calculation-issue-update-fix-available.aspx" target="_blank">blog post</a> also has links for Excel Services 2007, both 32 bit and 64 bit.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/veroblog.wordpress.com/128/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/veroblog.wordpress.com/128/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veroblog.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veroblog.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veroblog.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veroblog.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veroblog.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veroblog.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veroblog.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veroblog.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veroblog.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veroblog.wordpress.com/128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.meteorit.co.uk&blog=646149&post=128&subd=veroblog&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.meteorit.co.uk/2007/10/10/excel-2007-calculation-bug-fix-released-after-two-weeks/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/786403437a56d6c7ecd26e885004d2ad?s=96&#38;d=wavatar&#38;r=PG" medium="image">
			<media:title type="html">AdamV</media:title>
		</media:content>
	</item>
		<item>
		<title>Excel 2007 bug shows wrong answers to simple multiplications</title>
		<link>http://blog.meteorit.co.uk/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/</link>
		<comments>http://blog.meteorit.co.uk/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 14:04:30 +0000</pubDate>
		<dc:creator>Adam Vero</dc:creator>
				<category><![CDATA[Office System]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[floating point]]></category>
		<category><![CDATA[ROUND]]></category>

		<guid isPermaLink="false">http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/</guid>
		<description><![CDATA[This is a follow-up post to my earlier one about a bug in the way Excel 2007 displays the results of certain calculations. Read that one first of you have not already done so.
A few people in the comments thread in the Excel team blog post about the bug seem to have some misconceptions about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.meteorit.co.uk&blog=646149&post=127&subd=veroblog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>This is a follow-up post to my earlier one about a <a title="Excel 2007 calculation bug" href="http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/" target="_blank">bug in the way Excel 2007 displays the results of certain calculations</a>. Read that one first of you have not already done so.</p>
<p>A few people in the comments thread in the <a title="Excel team blog post about calculation bug in 2007" href="http://blogs.msdn.com/excel/archive/2007/09/25/calculation-issue-update.aspx" target="_blank">Excel team blog post about the bug</a> seem to have some misconceptions about the seriousness of the problem. Some have asked how often it is likely to come up, implying that they think it is vanishingly unlikely. This seems to be particularly those who have misunderstood that the example of 850*77.1 is only one simple example which is easy to remember and to type, but there are several more simple ones as well as thousands of other combinations which lead to the buggy result (due to floating point rounding errors in the calculation hitting a result which is sufficiently close to 65,535 to cause the false display of 100,000). Nine examples are shown in the screenshot below, and in a table you can easily copy and paste to try this for yourself.</p>
<p><span id="more-127"></span><br />
<h2>Nine examples of simple calculations which Excel can&#8217;t work out*</h2>
<p>* yes, I know the underlying value in the answer is as accurate as any previous version within the limits of the floating point calculation method and it just displays wrong, but in the real world that&#8217;s just as bad.</p>
<p><a href="http://veroblog.files.wordpress.com/2007/10/excel-bug-examples.png"><img style="border-width:0;margin:10px 15px 0 0;" height="204" alt="Excel bug example number pairs" src="http://veroblog.files.wordpress.com/2007/10/excel-bug-examples-thumb.png?w=217&#038;h=204" width="217" align="left" border="0"></a> </p>
<table cellspacing="0" cellpadding="1" width="251" border="1">
<tbody>
<tr>
<td valign="top" align="right" width="84">425</td>
<td valign="top" align="right" width="82">154.2</td>
<td valign="top" align="middle" width="83">=A1*B1</td>
</tr>
<tr>
<td valign="top" align="right" width="85">850</td>
<td valign="top" align="right" width="81">77.1</td>
<td valign="top" align="middle" width="83">=A2*B2</td>
</tr>
<tr>
<td valign="top" align="right" width="85">1700</td>
<td valign="top" align="right" width="81">38.55</td>
<td valign="top" align="middle" width="83">=A3*B3</td>
</tr>
<tr>
<td valign="top" align="right" width="85">6375</td>
<td valign="top" align="right" width="81">10.28</td>
<td valign="top" align="middle" width="83">=A4*B4</td>
</tr>
<tr>
<td valign="top" align="right" width="85">6425</td>
<td valign="top" align="right" width="81">10.2</td>
<td valign="top" align="middle" width="83">=A5*B5</td>
</tr>
<tr>
<td valign="top" align="right" width="85">12750</td>
<td valign="top" align="right" width="81">5.14</td>
<td valign="top" align="middle" width="83">=A6*B6</td>
</tr>
<tr>
<td valign="top" align="right" width="85">12850</td>
<td valign="top" align="right" width="81">5.1</td>
<td valign="top" align="middle" width="83">=A7*B7</td>
</tr>
<tr>
<td valign="top" align="right" width="85">25500</td>
<td valign="top" align="right" width="81">2.57</td>
<td valign="top" align="middle" width="83">=A8*B8</td>
</tr>
<tr>
<td valign="top" align="right" width="85">25700</td>
<td valign="top" align="right" width="81">2.55</td>
<td valign="top" align="middle" width="83">=A9*B9</td>
</tr>
</tbody>
</table>
<p>To use the examples in the table above, select them, copy (CTRL-C), open Excel.<br />With cell A1 selected go to Paste Special (use the dropdown arrow on the Paste button or do ALT, E, S). Choose Text and click OK. </p>
<p>If you divide 65,535 by integers starting from 1, then multiply the result by the same integer, you will quickly find many instances of the display bug. For example, A7=65535/7; B7=A7*7 (I actually used the ROW() function to generate these so&nbsp; I could copy and paste blocks quickly). For the integers 1 to 256, you will get 30 examples, the first being 65536/13=5041.15384615385, and 13*5041.15384615385 = 100,000.</p>
<h3>How many more examples are there?</h3>
<p>In the first 524,280 results, there are 80,242 bugs, which is approximately 15.3%. I do not consider this many to be rare, although I accept that these are all effectively getting one of a very few values close to 65,535 which have the bug &#8211; the number of buggy values is small, but the combinations of number pairs which lead to them is quite large. The nine examples given above all have exactly the same product &#8211; 65,534.999999999993 (you can see this as the value stored if you open the XML file for that worksheet)</p>
<p>There are several places where as many as seven consecutive integers lead to the bug; the first sequence this long starts at 100,334, the first set of six begins at 31,745. The longest gap I found in the first half million or so cases is 1,370 between the bugs at 262,589 and 263,959.</p>
<p>There are some interesting patterns to the integers which cause these. For example, 13*2^n, 49*2^n, 81*2^n and many other similar chains produce the bug.</p>
<p>Doing a similar exercise on numbers with exactly one decimal place (1.1, 1.2 &#8230; 52429.7 but not 1.0, 2.0 etc.) there are 64,325 bug pairs, about 13.64% of results. There is a sequence of 8 numbers from 28,059.0 to 28,059.7 which all produce the problem. A few simple example pairs include 20.4 * 3,212.5, 40.8 * 1,606.25 and 212.5 * 308.4. It starts to become clearer that there are quite a lot of calculations which could occur in normal business models and give rise to the error.</p>
<h3>Can I test my files to see if this is affecting my results?</h3>
<p>Simon Murphy has <a title="Code to test for the Excel 2007 bug in your real-world files" href="http://smurfonspreadsheets.wordpress.com/2007/09/25/excel-2007-calculation-bug-test-code/" target="_blank">published some code which you can use to test your files</a> for occurrences of the bug. He also <a title="How important is the Excel 2007 bug?" href="http://smurfonspreadsheets.wordpress.com/2007/09/28/excel-calculation-bug-take-2-not-many-hurt/" target="_blank">discusses how important this bug is overall</a>, in terms of actual impact to real users &#8211; noting that the number of people who have moved to excel 2007 so far seems to be relatively small. Not zero, but the problem would have had loads more impact if it had been undiscovered for another three to six months. I have a client who are rolling out as I write, migrating several thousand users from Office 2000 to Office 2007. They generate huge management accounting spreadsheets which spit out pretty reports on the one hand, but on the other the data they generate is piped via CSV into their ERP system. So one person would have a chart or summary table with correct figures, while the back-end systems would be out by a significant margin of error. This could take a long time before anyone could have isolated the error and it&#8217;s source.</p>
</p>
<h2>What about cases where this becomes an actual error in the value?</h2>
<p>As <a title="Excel 2007 bug becomes a wrong value not just incorrect display" href="http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/#more-117" target="_blank">previously discussed</a>, there are several ways in which the display error can become fixed as an incorrect value (of 100,000 or 100,001):</p>
<ul>
<li>using the ROUND function (but not ROUNDDOWN nor ROUNDUP)
<li>using &#8220;precision as displayed&#8221;
<li>exporting to CSV
<li>Paste Special &gt; Values
<li>using the TEXT function to convert to a string</li>
</ul>
<p>In addition, the MOD function seems to just break down altogether &#8211; it does not use the 100,000 but returns totally bogus results.<br />For example, MOD(850 * 77.1, n) gives -7.27596E-12 for integer values of n including 1 and 5 (which should both return 0). even MOD(65534.999999999999,1) gives a result of 0.999999999999 quite happily. Something quite odd going on with this, as MOD should never return a negative value, mathematically speaking.</p>
<h2>So what functions work safely?</h2>
<p><a href="http://veroblog.files.wordpress.com/2007/10/funwithminandmax.png"><img style="border-width:0;margin:5px 0 0 15px;" height="174" alt="Fun With Min and Max in Excel 2007" src="http://veroblog.files.wordpress.com/2007/10/funwithminandmax-thumb.png?w=322&#038;h=174" width="322" align="right" border="0"></a> In addition to the obvious mundane arithmetical calculations, most functions seem to work just fine. The MAX and MIN functions and their cousins LARGE and SMALL work as normal, as do conditional formats including data bars and colour scales. The screenshot on the right shows how odd this may appear.</p>
<p>The FLOOR and INT functions seem to use the correct underlying values and not propagate the error at all. ABS does not change the value, by design (just lose the sign) so it repeats the 100,000 display bug, but still does not lock this in. ABS(-850*77.1) shows 100,000. Adding 2 to that result gives 65,537.</p>
<p>ROUNDDOWN and ROUNDUP both seem to happily return 65,535 as their result. Of course, as Erich Neuwirth pointed out in the <a title="Excel bug discussion on Google Groups" href="http://groups.google.co.uk/group/microsoft.public.excel/browse_thread/thread/2bcad1a1a4861879/6850d1e3d2385246?hl=en" target="_blank">Google Groups thread on the subject of the bug</a>, in a way this should not be the case. We know that the result of 850*77.1 is not actually 65,535 but a tiny fraction under that due to floating point inaccuracies. <br />So that would mean that ROUNDDOWN (850 * 77.1, 0) should truncate the entire part of the number after the decimal point to give a result of 65,534. Now that would be seen as a bug, since we know that in reality 850*77.1 is actually 65,535 exactly. So there must be something in the algorithm for ROUNDDOWN which assumes if a number is close enough to a whole number, round it up to that value, treat it as an integer input and ROUND it down by precisely nothing. The same applies for ROUNDDOWN used for any number of decimal places up to 30 &#8211; it spits out 65,535 as if the inaccurate interim value never existed.</p>
<p>I am happy to continue saying &#8220;ROUNDDOWN is correct&#8221; in this context, since it is closer to our expectations than if every floating point error introduced were to cause whole numbers to be lost. A dollar here, a barrel of oil there, a square mile of land for someone else. This would not be acceptable, but I can accept that the number stored underneath is inaccurate to some bazillionths of a penny. Same goes for the other functions such as INT and FLOOR &#8211; they are actually giving incorrect results, but they are giving the result they should in a normal decimal universe. </p>
<p>Of course, if you are a nuclear physicist you don&#8217;t want Excel making these assumptions on your behalf for very small numbers, as they would be considered wrong in that context.</p>
<p>Don&#8217;t forget, these floating point errors have been around for a very long time. It is only a bug like this that makes people take notice what is going on &#8220;under the hood&#8221; and try to grasp the idea that their entire accounting career has been a lie, and every report they ever wrote was probably some kind of approximation. People generally fall into three camps on this:</p>
<ol>
<li>Blissfully unaware that their figures are inaccurate, and totally unaffected by the fact
<li>Aware that these errors exist in the n&#8217;th decimal place as a matter of fact, but happy to accept that this is not fatal
<li>Fully aware of the floating point problem, and careful to check that functions handle very-near-integers sensibly to give a result which would be expected in the real world if calculated in decimal.</li>
</ol>
<p>Which type are you?</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Spread the word : </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;;title=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;title=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;title=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to live" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;title=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;title=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;title=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://veroblog.wordpress.com/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/&amp;t=Excel 2007 bug in simple calculations creates incorrect values" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/veroblog.wordpress.com/127/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/veroblog.wordpress.com/127/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veroblog.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veroblog.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veroblog.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veroblog.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veroblog.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veroblog.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veroblog.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veroblog.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veroblog.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veroblog.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.meteorit.co.uk&blog=646149&post=127&subd=veroblog&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.meteorit.co.uk/2007/10/02/excel-2007-bug-shows-wrong-answers-to-simple-multiplications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/786403437a56d6c7ecd26e885004d2ad?s=96&#38;d=wavatar&#38;r=PG" medium="image">
			<media:title type="html">AdamV</media:title>
		</media:content>

		<media:content url="http://veroblog.files.wordpress.com/2007/10/excel-bug-examples-thumb.png" medium="image">
			<media:title type="html">Excel bug example number pairs</media:title>
		</media:content>

		<media:content url="http://veroblog.files.wordpress.com/2007/10/funwithminandmax-thumb.png" medium="image">
			<media:title type="html">Fun With Min and Max in Excel 2007</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Excel 2007 calculation bug displays apparently wrong numbers</title>
		<link>http://blog.meteorit.co.uk/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/</link>
		<comments>http://blog.meteorit.co.uk/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 22:03:01 +0000</pubDate>
		<dc:creator>Adam Vero</dc:creator>
				<category><![CDATA[Office System]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[floating point]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/</guid>
		<description><![CDATA[A bug has been found in Excel 2007 and Excel services 2007 which appears to calculate certain results incorrectly. In fact, the stored value of the result is correct, and other calculations based on that result will calculate correctly. The only error is in the display of the number, not the internal calculation. This is, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.meteorit.co.uk&blog=646149&post=117&subd=veroblog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>A bug has been found in Excel 2007 and Excel services 2007 which appears to calculate certain results incorrectly. In fact, the stored value of the result is correct, and other calculations based on that result will calculate correctly. The only error is in the display of the number, not the internal calculation. This is, of course, still a problem for anyone who is reading the values on screen or on a printout, or exporting them to other programs (see further down in this post).</p>
<p>According to the <a title="Excel display / calculation bug report" href="http://blogs.msdn.com/excel/archive/2007/09/25/calculation-issue-update.aspx" target="_blank">article on the Excel team blog about this bug</a>:</p>
<blockquote><p>The first example that we heard about was =77.1*850, but it became clear from our testing as well as additional reports that this was just one instance where <strong>Excel 2007 would return a value of 100,000 instead of 65,535</strong>.&nbsp; The majority of these additional reports were focused on multiplication (ex. =5.1*12850; =10.2*6425; =20.4*3212.5 ), but our testing showed that this really didn&#8217;t have anything do to with multiplication &#8211; it manifested itself with many but not all calculations in Excel that should have resulted in 65,535 (=65535*1 and =16383.75*4 worked for instance).&nbsp; Further testing showed a similar phenomenon with 65,536 as well.&nbsp; This issue only exists in Excel 2007, not previous versions.<br />&#8230;<br />Said another way, =850*77.1 will display an incorrect value, but if you then multiply the result by 2, you will get the correct answer (i.e. if A1 contains “=850*77.1”, and A2 contains “=A1*2”, A2 will return the correct answer of 131,070).</p>
</blockquote>
<p>So, it is important to note that most calculations which result in numbers near to or equal to 65,535 and 65,536 will be absolutely fine. It is only through some very specific oddities about how floating point numbers work that you will get one of the 12 situations where this bug occurs. If it does, you will have cells that read &#8220;100,000&#8243; rather than the correct answer. Anything else in Excel which you base on those cells <em>will be correct</em>. </p>
<p>You can add to them, multiply by them, show conditional formats such as colour scales or icon sets, even draw charts with those values and Excel will correctly handle the real, underlying value and not the displayed one. Macros or external programmatic methods of retrieving the cell&#8217;s contents also return the true stored value.</p>
<p><span id="more-117"></span><br />
<h2>When does this actually give you the wrong values (rather than just a wrong display)?</h2>
<h3>Rounding the result will change to the incorrect value permanently</h3>
<p>Some people find it confusing that when they have a column of figures added up, the sum at the bottom may not seem to be correct. </p>
<p><a href="http://veroblog.files.wordpress.com/2007/09/excel-rounding.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;margin:0 0 0 15px;" height="226" alt="Excel sums show up rounding errors" src="http://veroblog.files.wordpress.com/2007/09/excel-rounding-thumb.png?w=139&#038;h=226" width="139" align="right" border="0"></a>A typical example would be a column of prices including added sales tax (by multiplying by some decimal factor). These prices will only be shown to two decimal places in most currencies, but there will be a bit of rounding up or down to achieve this. </p>
<p> The sum of the underlying values may therefore differ from a sum of the displayed values, which gives the impression that there is a miscalculation somewhere, as shown in the example to the right. One way to avoid this is to use one of the ROUND functions to actually ROUND off the stored value to the nearest 1/100th (or force it to always ROUNDUP or ROUNDDOWN). The advantage of this is that if you change your mind you can easily change the formula to increase or decrease the accuracy of the underlying numbers, and my own recommendation would usually be to use this method. </p>
<p><strong>If you ROUND a cell or calculation which has a buggy result you will get the wrong value as a fixed end result.</strong> <br />So, 2 * ROUND(850 * 77.1, 0) gives 200,000 as a result, whereas 2 * 850 * 77.1 gives the correct 131,070. This is true whether you use ROUND directly on a buggy calculation or on a cell containing the end result of one. Curiously, ROUNDUP and ROUNDDOWN are able to ignore the bug, and both ROUNDDOWN(850 * 77.1, 0) and ROUNDUP(850 * 77.1, 0) correctly result in 65,535 (since this is what the value &#8220;actually&#8221; is if you ignore floating point errors).</p>
<h3>Telling Excel to use precision as displayed will keep the wrong value.</h3>
<p>The alternative to the ROUND function to get over sums which appear inconsistent is to change one of your Excel options to &#8220;Set precision as displayed&#8221;. This means that if you change the number of decimal places shown in a cell (using the toolbar buttons or changing the number formatting) the actual stored value will change immediately <em>and permanently</em> to be rounded to that many decimal places. If you decrease the decimals to zero, then increase them again, all your numbers will be .0000&#8230; Of course, if the cell contains the result of a formula, you lose nothing, but if it contains data values they will be irrevocably changed. The point of this feature is to save you using those ROUND functions, and to make sure that what you see always appears to be calculated consistently. </p>
<p>It is set on a per-workbook basis, so it is perfectly possible for you to receive a workbook which already has this turned on. By the same token, if you use this feature you may actually confuse someone else who works on that same workbook, or they may permanently lose data accuracy by changing the formatting of cells if they are not aware that this is taking place. </p>
<p><a href="http://veroblog.files.wordpress.com/2007/09/excel-precision.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;margin:5px 15px 5px 0;" height="224" alt="Set precision as displayed" src="http://veroblog.files.wordpress.com/2007/09/excel-precision-thumb.png?w=381&#038;h=224" width="381" align="left" border="0"></a>In order to be able to see if it is turned on or not, and change it if you wish, in Excel 2007 go to the Office button at the top left, choose Excel options, then the advance section and look for the subsection labelled &#8220;When calculating this workbook&#8221; where you will find &#8220;Set precision as displayed&#8221; (as shown on the left). </p>
<p>For Excel 2003 the same option is in Tools &gt; Options &gt; Calculation under Workbook options and called simply &#8220;precision as displayed&#8221;. NOTE: the bug described in this post does not affect Excel 2003, the way to turn on or off this feature is only included here for completeness since the state of the feature is saved with the workbook, not as part of your Excel options.</p>
<p><strong>If you have this feature turned on and your workbook contains calculation which have this bug, then those results will become permanently wrong (as 100,000 or 100,001).</strong> Any other calculations based on those cells will also be incorrect. Unless you can be sure to check every single cell in a workbook, which is only practical for very small files, you really need to turn this feature off when using Excel 2007 until a fix for the bug is applied.</p>
<h3>Exporting incorrect values</h3>
<p>As long as you handle the numbers within Excel, they work properly and simply display incorrectly. However, if you copy cells with these incorrect values and paste out to a text editor (such as Notepad), the incorrect display value is carried, because this always passes the number as shown, rather than the internal value. If you are only showing figures rounded to two decimal places (but not actually ROUNDing them) then Notepad would show the same as the sheet, and the underlying extra accuracy is lost.</p>
<p>While Notepad is useful to quickly see these bugs in action, it is not usually used as an import and export routine for large volumes of multi-column data. A common method is to export to a CSV file which can then be imported into another program (often a database which cannot read and write to Excel files directly). <strong>CSV files will also carry the incorrect display figure instead of the underlying stored value.</strong> This is crucial for anyone using Excel as a number crunching machine to export results to a third party application. </p>
<p>I have a client who uses Excel to churn out management reports about their product sales, profits and so on. The reports that people read in this case are summaries (often from pivot tables), and the chance of them actually seeing a number <em>on those summaries </em>with this bug are vanishingly small. However, they use the underlying basic calculation data to export and feed into their ERP system, and here there is a risk that a number could be passed through at the wrong value via a CSV file. Chances? Small, but not sufficiently small to be ignored.</p>
<h2></h2>
<h2>FUD is in the air</h2>
<p>There is unfortunately a lot of sidetracking and &#8220;fear, uncertainty and doubt&#8221; (FUD) in the comments to that article about floating point accuracy <em>in principle</em>. No-one has ever claimed that Excel or any other calculation program using floating point arithmetic is always totally accurate to an infinite number of decimal places, this is inherently unachievable using binary notation to store numbers and display the results in decimal. At face value it seems annoying that Excel does not treat the calculation of &#8220;simple&#8221; numbers such as 4.1-4 correctly and get exactly 0.1 (rather than 0.0999999999999996 which it does get). </p>
<p>The reality is that in most cases no-one is looking at enough decimal places to notice or care, or even for the error to compound up into something important. On the flip side, Excel will happily handle arbitrarily small binary fractions such as 1/18,446,744,073,709,551,616 + 1/4,294,967,296 without blinking. A human trying to work on such numbers would inevitably at some point convert them to that strange human notation called decimal and lose some accuracy.</p>
<p>Normally, Excel handles these rounding errors gracefully, and still displays something very near to the correct value, since the error is usually down in the dozens of decimal places. The oddity on this occasion is that for some reason it makes a bad assumption as to what constitutes a reasonable value to display and gets it rather visibly wrong.</p>
<p>I will of course post an update once a fix is available.</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Spread the word: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;;title=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;title=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;title=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to live" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;title=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;title=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;title=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://veroblog.wordpress.com/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/&amp;t=Excel 2007 calculation bug displays wrong answers" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/veroblog.wordpress.com/117/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/veroblog.wordpress.com/117/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veroblog.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veroblog.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veroblog.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veroblog.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veroblog.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veroblog.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veroblog.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veroblog.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veroblog.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veroblog.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.meteorit.co.uk&blog=646149&post=117&subd=veroblog&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.meteorit.co.uk/2007/09/26/excel-2007-calculation-bug-displays-apparently-wrong-numbers/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/786403437a56d6c7ecd26e885004d2ad?s=96&#38;d=wavatar&#38;r=PG" medium="image">
			<media:title type="html">AdamV</media:title>
		</media:content>

		<media:content url="http://veroblog.files.wordpress.com/2007/09/excel-rounding-thumb.png" medium="image">
			<media:title type="html">Excel sums show up rounding errors</media:title>
		</media:content>

		<media:content url="http://veroblog.files.wordpress.com/2007/09/excel-precision-thumb.png" medium="image">
			<media:title type="html">Set precision as displayed</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
	</channel>
</rss>