Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Bad Calculation in Excel

The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?

0.94
-5
5
25
-25
3.06
-25
21
0

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 440
Default Bad Calculation in Excel

I have tried it with the SUM cell formatted as number to two decimals and it
worked fine - 0.00
(Excel 2003)
--
Traa Dy Liooar

Jock


"Perplexed" wrote:

The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?

0.94
-5
5
25
-25
3.06
-25
21
0

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Bad Calculation in Excel

Fixed point binary representation. Try to calculate the exact binary
representation of 0.94 (or of 3.06).
Same reason that you may get similar small rounding errors with a decimal
calculation if you've got 10/3 + 10/3 + 10/3 and try to subtract 10 from the
result.
--
David Biddulph

"Perplexed" wrote in message
...
The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?

0.94
-5
5
25
-25
3.06
-25
21
0



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Bad Calculation in Excel

Thanks for the reply. Here's more info on this problem.
1. These cells are summed up in a pivot table where the pivot table has the
format of accounting (to dash out zeros in display).
2. Although the sum of these numbers should be net flat zero, it shows up
as (0.00) because I have a conditional formatting set to show negative
numbers in red 0.00 format.
3. All other zero numbers do show as "-" except for the cell that sums up
these numbers.


"Jock" wrote:

I have tried it with the SUM cell formatted as number to two decimals and it
worked fine - 0.00
(Excel 2003)
--
Traa Dy Liooar

Jock


"Perplexed" wrote:

The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?

0.94
-5
5
25
-25
3.06
-25
21
0

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 227
Default Bad Calculation in Excel

You can put your calculation in a ROUND function. Round to the number
of digits needed.

Conversely, you can test for the sum being less than the smallest
number you'll accept as not zero and force the calculation to zero if
that occurs. As an example:

=IF(SUM(A1:A8)<.0001,0,SUM(A1:A8))

Mark Lincoln

On Sep 10, 11:08 am, Perplexed
wrote:
Thanks for the reply. Here's more info on this problem.
1. These cells are summed up in a pivot table where the pivot table has the
format of accounting (to dash out zeros in display).
2. Although the sum of these numbers should be net flat zero, it shows up
as (0.00) because I have a conditional formatting set to show negative
numbers in red 0.00 format.
3. All other zero numbers do show as "-" except for the cell that sums up
these numbers.



"Jock" wrote:
I have tried it with the SUM cell formatted as number to two decimals and it
worked fine - 0.00
(Excel 2003)
--
Traa Dy Liooar


Jock


"Perplexed" wrote:


The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?


0.94
-5
5
25
-25
3.06
-25
21
0- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Bad Calculation in Excel

Thanks that will come in handy for other need, however, in this case, it
doesn't work because using the Fixed function, the sum function shows 0.

"David Biddulph" wrote:

Fixed point binary representation. Try to calculate the exact binary
representation of 0.94 (or of 3.06).
Same reason that you may get similar small rounding errors with a decimal
calculation if you've got 10/3 + 10/3 + 10/3 and try to subtract 10 from the
result.
--
David Biddulph

"Perplexed" wrote in message
...
The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?

0.94
-5
5
25
-25
3.06
-25
21
0




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Bad Calculation in Excel

I wasn't suggesting that you should use the Excel FIXED function (which
rounds a number to the specified number of decimals, formats the number in
decimal format using a period and commas, and returns the result as text).

I was saying that in a fixed point binary representation (which is what
Excel and most computing calculations use) you are likely to get rounding
errors when you try to represent decimal numbers. The only decimal numbers
that can be expressed exactly in binary are numbers such as 0.5, 0.25,
0.125, ... and their multiples. Numbers such as 0.1 do not have an exact
binary representation.
--
David Biddulph

"Perplexed" wrote in message
...
Thanks that will come in handy for other need, however, in this case, it
doesn't work because using the Fixed function, the sum function shows 0.


"David Biddulph" wrote:

Fixed point binary representation. Try to calculate the exact binary
representation of 0.94 (or of 3.06).
Same reason that you may get similar small rounding errors with a decimal
calculation if you've got 10/3 + 10/3 + 10/3 and try to subtract 10 from
the
result.


"Perplexed" wrote in message
...
The sum of these numbers should be zero (0). However, no matter what
the
cell format, the following numbers add up to 3.55271E-15. Any ideas
why?

0.94
-5
5
25
-25
3.06
-25
21
0






  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Bad Calculation in Excel

This would work but I need to display legitimate negative numbers. Thanks.

"Mark Lincoln" wrote:

You can put your calculation in a ROUND function. Round to the number
of digits needed.

Conversely, you can test for the sum being less than the smallest
number you'll accept as not zero and force the calculation to zero if
that occurs. As an example:

=IF(SUM(A1:A8)<.0001,0,SUM(A1:A8))

Mark Lincoln

On Sep 10, 11:08 am, Perplexed
wrote:
Thanks for the reply. Here's more info on this problem.
1. These cells are summed up in a pivot table where the pivot table has the
format of accounting (to dash out zeros in display).
2. Although the sum of these numbers should be net flat zero, it shows up
as (0.00) because I have a conditional formatting set to show negative
numbers in red 0.00 format.
3. All other zero numbers do show as "-" except for the cell that sums up
these numbers.



"Jock" wrote:
I have tried it with the SUM cell formatted as number to two decimals and it
worked fine - 0.00
(Excel 2003)
--
Traa Dy Liooar


Jock


"Perplexed" wrote:


The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?


0.94
-5
5
25
-25
3.06
-25
21
0- Hide quoted text -


- Show quoted text -




  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 227
Default Bad Calculation in Excel

Well, of course you do. Leave it to me to ignore the negative numbers
in your example. Let's modify my example:

=IF(ABS(SUM(A1:A8))<.0001,0,SUM(A1:A8))

That should work better. In this example, any sum within +/-.0001 of
zero becomes zero.

Sorry for the confusion.

Mark Lincoln

On Sep 10, 2:30 pm, Perplexed
wrote:
This would work but I need to display legitimate negative numbers. Thanks.



"Mark Lincoln" wrote:
You can put your calculation in a ROUND function. Round to the number
of digits needed.


Conversely, you can test for the sum being less than the smallest
number you'll accept as not zero and force the calculation to zero if
that occurs. As an example:


=IF(SUM(A1:A8)<.0001,0,SUM(A1:A8))


Mark Lincoln


On Sep 10, 11:08 am, Perplexed
wrote:
Thanks for the reply. Here's more info on this problem.
1. These cells are summed up in a pivot table where the pivot table has the
format of accounting (to dash out zeros in display).
2. Although the sum of these numbers should be net flat zero, it shows up
as (0.00) because I have a conditional formatting set to show negative
numbers in red 0.00 format.
3. All other zero numbers do show as "-" except for the cell that sums up
these numbers.


"Jock" wrote:
I have tried it with the SUM cell formatted as number to two decimals and it
worked fine - 0.00
(Excel 2003)
--
Traa Dy Liooar


Jock


"Perplexed" wrote:


The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?


0.94
-5
5
25
-25
3.06
-25
21
0- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Bad Calculation in Excel

Thanks all. I solved it for this purpose by using the ROUND() function in
the display since I vlookup the pivot table values. Appreciate all your help.

"Mark Lincoln" wrote:

Well, of course you do. Leave it to me to ignore the negative numbers
in your example. Let's modify my example:

=IF(ABS(SUM(A1:A8))<.0001,0,SUM(A1:A8))

That should work better. In this example, any sum within +/-.0001 of
zero becomes zero.

Sorry for the confusion.

Mark Lincoln

On Sep 10, 2:30 pm, Perplexed
wrote:
This would work but I need to display legitimate negative numbers. Thanks.



"Mark Lincoln" wrote:
You can put your calculation in a ROUND function. Round to the number
of digits needed.


Conversely, you can test for the sum being less than the smallest
number you'll accept as not zero and force the calculation to zero if
that occurs. As an example:


=IF(SUM(A1:A8)<.0001,0,SUM(A1:A8))


Mark Lincoln


On Sep 10, 11:08 am, Perplexed
wrote:
Thanks for the reply. Here's more info on this problem.
1. These cells are summed up in a pivot table where the pivot table has the
format of accounting (to dash out zeros in display).
2. Although the sum of these numbers should be net flat zero, it shows up
as (0.00) because I have a conditional formatting set to show negative
numbers in red 0.00 format.
3. All other zero numbers do show as "-" except for the cell that sums up
these numbers.


"Jock" wrote:
I have tried it with the SUM cell formatted as number to two decimals and it
worked fine - 0.00
(Excel 2003)
--
Traa Dy Liooar


Jock


"Perplexed" wrote:


The sum of these numbers should be zero (0). However, no matter what the
cell format, the following numbers add up to 3.55271E-15. Any ideas why?


0.94
-5
5
25
-25
3.06
-25
21
0- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




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 Calculation BrianC500 Excel Discussion (Misc queries) 6 July 21st 06 04:04 PM
Excel IRR calculation thudi Excel Worksheet Functions 1 October 26th 05 05:50 AM
Excel Calculation rajeev Excel Worksheet Functions 9 June 1st 05 12:24 PM
How do I use a rounded calculation result in another calculation? vnsrod2000 Excel Worksheet Functions 1 January 26th 05 10:11 PM
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 03:58 PM.

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

About Us

"It's about Microsoft Excel"