Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
0-0 Wai Wai ^-^
 
Posts: n/a
Default Strange Calculation Error in Excel


Hi.
I have a table of numbers, and I do some simple Math based on this data.
Eg:
4.1 4.1 3.97 4.03
4.15 4.15 4.1 4.1


For the formula "=A4-B4", the answer given is
"-0.069999999999999400000000000000"
It should be just -0.07.

Then I checked the value for A4 & B4, the values a
4.030000000000000000000000000000
4.100000000000000000000000000000

What's wrong with Excel?
How can I correct this error?
PS: If anyone wishes to see the original Excel file, please leave your email
address here. Thanks!

--
Additional information:
- I'm using Office XP
- I'm using Windows XP

¥»¤Hªº¯à¤O«D±`¦³**. ¦p¦³¤£·í¤§³B, ±æÃѪ̤£§[½ç¥¿!!
My ability is very limited. Hope you will not mind to enlighten me if I do
wrongly.


  #2   Report Post  
Posted to microsoft.public.excel.misc
Fred Smith
 
Posts: n/a
Default Strange Calculation Error in Excel

You can't correct the error. It's how computers have worked since day one. It
happens because computers convert from decimal to binary, and not all
conversions are perfect.

To avoid to problem, use the Round function, as in

=Round(a4-b4,2)

--
Regards,
Fred


"0-0 Wai Wai ^-^" wrote in message
...

Hi.
I have a table of numbers, and I do some simple Math based on this data.
Eg:
4.1 4.1 3.97 4.03
4.15 4.15 4.1 4.1


For the formula "=A4-B4", the answer given is
"-0.069999999999999400000000000000"
It should be just -0.07.

Then I checked the value for A4 & B4, the values a
4.030000000000000000000000000000
4.100000000000000000000000000000

What's wrong with Excel?
How can I correct this error?
PS: If anyone wishes to see the original Excel file, please leave your email
address here. Thanks!

--
Additional information:
- I'm using Office XP
- I'm using Windows XP

¥»¤Hªº¯à¤O«D±`¦³**. ¦p¦³¤£·í¤§³B, ±æÃѪ̤£§[½ç¥¿!!
My ability is very limited. Hope you will not mind to enlighten me if I do
wrongly.




  #3   Report Post  
Posted to microsoft.public.excel.misc
0-0 Wai Wai ^-^
 
Posts: n/a
Default Strange Calculation Error in Excel


"Fred Smith" ¦b¶l¥ó
¤¤¼¶¼g...
You can't correct the error. It's how computers have worked since day one. It
happens because computers convert from decimal to binary, and not all
conversions are perfect.

To avoid to problem, use the Round function, as in

=Round(a4-b4,2)


Thanks for your reply.
But the solution is not practical since I need to do so for everything I
calculate in Excel.

Take the above example again:
C4: =A4-B4
D4: =countif(C4, -0.07)

The answer is 0. Too bad! It should be 1.
Your answer did eliminate the problem, but I have many different formulas which
are baffled by this strange calculation error.
It is tons of rewriting. Oh no!!

Is there any practical solution I would take to workaround this "calcualtion
error"?
Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Strange Calculation Error in Excel

"0-0 Wai Wai ^-^" wrote:
"Fred Smith" :
To avoid to problem, use the Round function, as in
=Round(a4-b4,2)


Thanks for your reply. But the solution is not practical
since I need to do so for everything I calculate in Excel.
[....]
I have many different formulas which are baffled by this
strange calculation error. It is tons of rewriting. Oh no!!


Try setting Tools Options Calculation Precision As
Displayed.

Of course, then you might need to adjust the format of
some cells to be sure that they display the needed precision.
This includes "helper" cells, which you might have hidden.

Caveat emptor.
  #5   Report Post  
Posted to microsoft.public.excel.misc
0-0 Wai Wai ^-^
 
Posts: n/a
Default Strange Calculation Error in Excel



" ¦b¶l¥ó
¤¤¼¶¼g...
"0-0 Wai Wai ^-^" wrote:
"Fred Smith" :
To avoid to problem, use the Round function, as in
=Round(a4-b4,2)


Thanks for your reply. But the solution is not practical
since I need to do so for everything I calculate in Excel.
[....]
I have many different formulas which are baffled by this
strange calculation error. It is tons of rewriting. Oh no!!


Try setting Tools Options Calculation Precision As
Displayed.

Of course, then you might need to adjust the format of
some cells to be sure that they display the needed precision.
This includes "helper" cells, which you might have hidden.

Caveat emptor.


Hi.
Is it possible to set something like it is displayed up to 2 decimal places, but
the precision holds up to 10 decimal places or so?

I don't wish to show all figures up to 10 decminal places. It is just too
clumsy.
And since this setting is global, it is still not preferable.




  #6   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Strange Calculation Error in Excel

Hi Wai Wai,

You might want to try my Excel add-in, xlPrecision 2.0. It avoids these
errors by never converting to binary.

You can download the free edition of xlPrecision 2.0 from here and use
it as long as you wish:

http://PrecisionCalc.com


Good Luck,

Greg Lovern
http://PrecisionCalc.com
Eliminate Hidden Spreadsheet Errors

  #7   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Strange Calculation Error in Excel

You might want to try my Excel add-in, xlPrecision 2.0.
It avoids these errors by never converting to binary.
[....]
Greg Lovern
http://PrecisionCalc.com
Eliminate Hidden Spreadsheet Errors


Fascinating! I would imagine it slows computation
tremendously. Do you have any performance comparisons?

Would be better if Excel itself implemented BCD, at least
as an option. With nano-to-picosec instruction times, it is
probably a reasonable trade-off. I hope Bill is listening :-).

  #8   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Strange Calculation Error in Excel

Hi Joe,

I would imagine it slows computation tremendously. Do you have any performance comparisons? <


I haven't benchmarked it against rounding in Excel, but obviously it's
slower than Excel. xlPrecision's main purpose is high precision (i.e.,
more than 15 significant digits), and one reasonably expects to
sacrifice performance for that. Avoiding binary conversion errors is a
happy side effect.

I heard praise, and no complaints, for version 1.0's performance (for
high precision), and 2.0 is faster. And the next version will be faster
still.


Thanks,

Greg Lovern
http://PrecisionCalc.com
Eliminate Hidden Spreadsheet Errors

  #9   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Strange Calculation Error in Excel

Hi Fred --

I understand the reason why decimals will not always convert perfectly
to binary, but the similar problem that I kept running into (primarily
using Lotus 1-2-3 Ver 1A -- I've only recently had to start working in
Excel, and so far have had only one occasion to do a work-around in
that program) is that I would get floating point errors when adding
WHOLE NUMBERS that mathematically should sum to zero. Surely whole
numbers should convert perfectly to binary. I frequently needed to
test whether a sum equaled zero, but the best fix I could come up with
was "if(abs([formula])<0.001,[do A],[do B]).

Why adding and subtracting whole numbers would yield these same 15th
decimal place discrepancies is completely beyond my comprehension.

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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
How can I do an hourly salary calculation in Excel AndyM Excel Discussion (Misc queries) 2 September 15th 05 05:29 AM
Excel: Area under a curve calculation Nick_C Charts and Charting in Excel 1 August 25th 05 03:44 PM
Really Strange Excel Issue MC Excel Discussion (Misc queries) 1 March 3rd 05 03:54 PM
Difference in number of Excel NewsGroups Hari Prasadh Excel Discussion (Misc queries) 1 January 25th 05 11:32 AM


All times are GMT +1. The time now is 02:22 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"