ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel question with variable definition (https://www.excelbanter.com/excel-programming/324585-excel-question-variable-definition.html)

Yong Kim

Excel question with variable definition
 
Hi,

I have a macro running on Excel 2003. I simply read a value from a cell
using macro in which the value is defined as single, double, or even variant,
then write the value on another cell. Now the number has some left over
values. For instance, 100.1 becomes 100.099998474121. If the original number
is an integer, then it is ok. However, any decimal number resulted in a
different number though there is about 0.1% difference. Is there something I
am doing wrong, or is this a bug? Any help would be appreciated.
--
Yong Kim

Gary Brown[_5_]

Excel question with variable definition
 
This is a 'bug' in Excel. For a full description, see the website below.
The website specifically goes through Excel 97 but the same is true of Excel
2003.
http://www.cpearson.com/excel/rounding.htm

To solve your problem, use the round() function.
HTH,
Gary Brown

"Yong Kim" wrote:

Hi,

I have a macro running on Excel 2003. I simply read a value from a cell
using macro in which the value is defined as single, double, or even variant,
then write the value on another cell. Now the number has some left over
values. For instance, 100.1 becomes 100.099998474121. If the original number
is an integer, then it is ok. However, any decimal number resulted in a
different number though there is about 0.1% difference. Is there something I
am doing wrong, or is this a bug? Any help would be appreciated.
--
Yong Kim


Yong Kim

Excel question with variable definition
 
Thanks very much. It helped me to understand the problem. I really appreciate
your support.

"Gary Brown" wrote:

This is a 'bug' in Excel. For a full description, see the website below.
The website specifically goes through Excel 97 but the same is true of Excel
2003.
http://www.cpearson.com/excel/rounding.htm

To solve your problem, use the round() function.
HTH,
Gary Brown

"Yong Kim" wrote:

Hi,

I have a macro running on Excel 2003. I simply read a value from a cell
using macro in which the value is defined as single, double, or even variant,
then write the value on another cell. Now the number has some left over
values. For instance, 100.1 becomes 100.099998474121. If the original number
is an integer, then it is ok. However, any decimal number resulted in a
different number though there is about 0.1% difference. Is there something I
am doing wrong, or is this a bug? Any help would be appreciated.
--
Yong Kim



All times are GMT +1. The time now is 02:53 AM.

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