+ Reply to Thread
Results 1 to 3 of 3

Comparing type double variables of different lengths

  1. #1
    Registered User
    Join Date
    10-01-2007
    Posts
    23

    Comparing type double variables of different lengths

    I am trying to compare two numbers of different lengths up to a certain decimal. For example, 6.01, and 6.01243434. If the numbers match I want to output "YES" in a third cell.

    I figured the following would work:
    Please Login or Register  to view this content.
    I am running into a problem when I have a decimal that is of a certain length. Take -0.0693080388371247 for example. VBA stores this as -6.93080388371247E-02. When I attempt to compare this to my other decimal, the values do not match, even though it actually is the same number. Is there anyway I can get around this? I've attached a small workbook that demonstrates my problem.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This seems to work

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-01-2007
    Posts
    23
    Thanks that works great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1