#1   Report Post  
Posted to microsoft.public.excel.misc
JKC
 
Posts: n/a
Default calculation issue?


Here's the deal:
I have 4 cells: cell1 = 53711.83
cell2 = 53711.83
cell3 = 69.12
cell4 = 69.12
When I use a formula = (cell1+cell3-cell2-cell4)/31.25 I should get 0.
Instead I get 0.0000000000000836735125631094.

Cells 1-4 are based on a dsum. I checked these cells and my original
data out to 30 decimal places and I can't figure out where my problem
is. I have the same setup in several places in my spreadsheet and in
some places the formula works as it should, in a few places it doesn't.
Where are these extra #s coming from? Any Ideas? Thanks in advance


--
JKC
------------------------------------------------------------------------
JKC's Profile: http://www.excelforum.com/member.php...o&userid=31166
View this thread: http://www.excelforum.com/showthread...hreadid=524576

  #2   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK
 
Posts: n/a
Default calculation issue?

Decimal fractions don't always convert easily to binary. Some fractions
like 1/3 cannot be expressed exactly in decimal. Therefore, small
rounding errors creep in to some formulae, and yours is one such
example. Try rounding the results of your dsum to 2 dp using ROUND( )
and see if this helps matters.

Hope this helps.

Pete

  #3   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default calculation issue?


This is a known issue in excel, see here

http://support.microsoft.com/kb/78113/en-us


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=524576

  #4   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default calculation issue?


This is a known issue in excel, see here

http://support.microsoft.com/kb/78113/en-us


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=524576

  #5   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis
 
Posts: n/a
Default calculation issue?

Excel is clearly documented (Help for "Excel specifications and limits") to
display no more than 15 decimal digits. To see more you must used the D2D
function at
http://groups.google.com/group/micro...06871cf92f8465
Using that, you will see that neither 53711.83 nor 69.12 can be represented
exactly.

This issue common to all software that does binary math (almost all
software). When you do math with approximate inputs, it should be no
surprise when the output is also only approximate.

What you have observed is the binary equivalent of
1-(1/3)-(1/3)-(1/3) = 1-0.3333-0.3333-0.3333 = 0.0001
The math is right, but the answer is not the expected zero because of
necessary initial approximations to 1/3, which cannot be represented exactly
as a decimal fraction in finite precision.

Most terminating decimal fractions (including .83 and .12) are
non-terminating binary fractions ...

Excel's documented 15-digit limit can be used to predict the magnitude of
approximation issues. Your problem can then be thought of as
53711.8300000000????
69.1200000000000?
-53711.8300000000????
-69.1200000000000?
---------------------
0.0000000000????
which is consistent with Excel's answer
0.00000000000261
(the final division was irrelevant to the basic issue and hence was omitted
here)

Since the issue is approximation to inputs, not subsequent math, Pete's
rounding suggestion is entirely reasonable, and does no violence to the
calculations.

"JKC" wrote:


Here's the deal:
I have 4 cells: cell1 = 53711.83
cell2 = 53711.83
cell3 = 69.12
cell4 = 69.12
When I use a formula = (cell1+cell3-cell2-cell4)/31.25 I should get 0.
Instead I get 0.0000000000000836735125631094.

Cells 1-4 are based on a dsum. I checked these cells and my original
data out to 30 decimal places and I can't figure out where my problem
is. I have the same setup in several places in my spreadsheet and in
some places the formula works as it should, in a few places it doesn't.
Where are these extra #s coming from? Any Ideas? Thanks in advance


--
JKC
------------------------------------------------------------------------
JKC's Profile: http://www.excelforum.com/member.php...o&userid=31166
View this thread: http://www.excelforum.com/showthread...hreadid=524576




  #6   Report Post  
Posted to microsoft.public.excel.misc
JKC
 
Posts: n/a
Default calculation issue?


Thanks for everyone's help on this one.

JKC


--
JKC
------------------------------------------------------------------------
JKC's Profile: http://www.excelforum.com/member.php...o&userid=31166
View this thread: http://www.excelforum.com/showthread...hreadid=524576

  #7   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK
 
Posts: n/a
Default calculation issue?

I like your choice of phrase, Jerry - " ... does no violence to the
calculations ..."

Pete

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation speed issue Steve M Excel Discussion (Misc queries) 4 January 14th 06 02:18 AM
Issue with zero/# issue!! drvortex Excel Worksheet Functions 4 December 6th 05 06:22 PM
Vlookup Calculation Issue cvolkert Excel Worksheet Functions 0 September 7th 05 02:28 AM
Calculation Setting in Excel Stuart Bisset Excel Discussion (Misc queries) 0 June 17th 05 09:54 AM
How do I use a rounded calculation result in another calculation? vnsrod2000 Excel Worksheet Functions 1 January 26th 05 09:36 PM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"