Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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

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
VBA variable definition help needed. jenn k New Users to Excel 4 September 5th 08 08:55 PM
[variable] definition Veena Excel Programming 3 August 19th 04 01:23 PM
variable range definition jmp Excel Programming 2 May 6th 04 11:06 PM
question on the definition of refer to efi[_5_] Excel Programming 3 October 28th 03 12:58 PM
Problem Using an Object Variable in a Class Definition Boxman Excel Programming 2 August 28th 03 03:05 AM


All times are GMT +1. The time now is 03:36 AM.

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"