D
Dave O
By coincidence, two posts today have asked about Excel adding phantom
decimal places to entries:
http://groups.google.com/group/micr...9b8fa1aba62/6136d0799e3421d4#6136d0799e3421d4
http://groups.google.com/group/micr...666beaa4d05/5c2abd3771aaa94f#5c2abd3771aaa94f
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?
decimal places to entries:
http://groups.google.com/group/micr...9b8fa1aba62/6136d0799e3421d4#6136d0799e3421d4
http://groups.google.com/group/micr...666beaa4d05/5c2abd3771aaa94f#5c2abd3771aaa94f
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?