Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Busselton, Western Australia, Australia
    Posts
    59
    Thanks
    1
    Thanked 2 Times in 2 Posts

    When 8.95-7.95!=1 (Office 2k SP1)

    I have a situation where I need to test a value to see if a difference of 1 exists or not... Seems easy doesn't it.... sheet seems to have been working great until I struck two values of 8.95-7.95 which returned a value of 0.9999999999999999 which as we all know computers will not assess as being "1". grrr what a great waste of time has been spent tracking this error down!
    The following is a copy of the immediate window from Excel VBA where ? is used to evaluate an expression, with the answer on the following line.
    ?7.95-6.95
    1
    ?8.95-7.95
    0.999999999999999
    ?9.95-8.95
    1
    ?8.94-7.94
    0.999999999999999
    ?8-7
    1
    ?8.1-7.1
    1
    ?8.96-7.96
    1
    ?8.94-7.94
    0.999999999999999
    ?8.9-7.9
    1
    ?8.99-7.99
    1
    ?8.93-7.93
    1
    As you can see there is a few combinations that do not give the expected result!
    Any ideas as to how I can overcome this problem?
    I have tried this on 3 different PC's, all came up with the same answers!
    Thanks in advance.
    Brian.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When 8.95-7.95!=1 (Office 2k SP1)

    See if THIS THREAD will help.

    Try this:

    ?round(8.95-7.95,0)
    1
    Legare Coleman

  3. #3
    Star Lounger
    Join Date
    Apr 2002
    Location
    Busselton, Western Australia, Australia
    Posts
    59
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Re: When 8.95-7.95!=1 (Office 2k SP1)

    Thanks Heaps
    That explains everything very nicely!
    I suspected that was going to be the case but did not know how to prove/disprove the thought.
    Regards
    Brian.

Posting Permissions

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