ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel adds phantom decimal places: why? (https://www.excelbanter.com/excel-discussion-misc-queries/40635-excel-adds-phantom-decimal-places-why.html)

Dave O

Excel adds phantom decimal places: why?
 
By coincidence, two posts today have asked about Excel adding phantom
decimal places to entries:

http://groups.google.com/group/micro...36d0799e3421d4

http://groups.google.com/group/micro...2abd3771aaa94f

I have experienced this as well: when I enter a dollar amount with just
2 decimal places and convert those values to variables in VBA code,
Excel adds trailing decimal places. These do not affect the dollar
value, but they do create problems when performing a comparison, such
as
If TotalBux = 0 Then (etc)
In this example, the value of TotalBux can be so close to zero that it
makes no effective difference: except that mathematically it does not
equal zero due to the decimal places, creating an internal logic flaw.

The workaround is to round to an appropriate number of decimal places,
but why does this happen?


JE McGimpsey

See

http://cpearson.com/excel/rounding.htm

In article .com,
"Dave O" wrote:

The workaround is to round to an appropriate number of decimal places,
but why does this happen?



All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com