+ Reply to Thread
Results 1 to 9 of 9

True / False problem

  1. #1
    Registered User
    Join Date
    08-05-2004
    Posts
    10

    True / False problem

    i have a function that apparently is not working.

    in the cell I have: =b21=C17-C15

    B21 is supposed to equal the difference between C17 and C15. All cells are formatted the same way (Accounting, 2 Decimal). The numbers are coming up the same but I'm still getting FALSE.

    Can someone help?

    Thanks!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    It's probably a precision issue....

    try:

    =round(b21,2)=round(C17-C15,2)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-05-2004
    Posts
    10
    I tried the formula you suggested but it did not correct the problem.
    Why would it do this on certain worksheets and not all? I have several worksheets in the spreadsheet and only a few of them show this problem.

    Thanks!

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    It is most likely some sort of precision problem... if B21, C17 and/or C15 are results of formulas, then it is more likely the case...

    What are the numbers like if you format them as General? Is B21 exactly the same as C17-C15?

    Perhaps you can attach your worksheet, pointing out the problem.

  5. #5
    Registered User
    Join Date
    08-05-2004
    Posts
    10
    Attached is a spreadsheet.

    Thanks!
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    In your sample sheet...

    B21=676.59

    C17=39,825.69

    C15=<blank>

    so how is B21 supposed to equal C17-C15?

    Perhaps you meant C17-B15?

    so then formula would be =ROUND(B21,2)=ROUND(C17-B15,2) which results in TRUE.

  7. #7
    Registered User
    Join Date
    08-05-2004
    Posts
    10
    Quote Originally Posted by NBVC
    In your sample sheet...

    B21=676.59

    C17=39,825.69

    C15=<blank>

    so how is B21 supposed to equal C17-C15?

    Perhaps you meant C17-B15?

    so then formula would be =ROUND(B21,2)=ROUND(C17-B15,2) which results in TRUE.
    yes...it was B15...I had moved data and forgot. I still don't get why it would require ROUND. 2 of the 3 are entered data and the 3rd one is addition.

    Thanks for the help!
    Last edited by cdbearden; 08-12-2008 at 03:33 PM.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    For some strange reason Excel has issues with precision in some operations, especially when it is using the result of another formula within the affected formula...

    If you try subtracting B15 from C17, you actually get result of 676.520000000004

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Nothing strange, and it is NOT an Excel thing. Your computer (and therefore Excel) uses a floating point representation of numbers, which intrinsically has finite precision.

    For example, you know that 1/3 = 0.333 ..., with those 3s going on until your fingers get tired. If they get tired after 6 digits, the closest number you can store to 1/3 is 0.333333. No matter how many digits you had available, you couldn't write the number exactly. The resulting error propagates to every downstream calculation you perform.

    IEEE double precision gives you 15 digits, which is adequate for most purposes -- but even it it had more, lots more, you would still have the same problem.

    Further, the floating-point format is not decimal, it's binary. (Actually, there is an IEEE decimal floating point format, but it seems to have gone nowhere). The number 1/10 = 0.1 is actually a repeating decimal in binary; in Hex, it's 0.19999999... . So you can't store the value of a dime exactly in Excel (or on your computer).

    If you're dealing in dollars, you should generally round to two decimals after every calculation. When you make a loan payment, you pay some exact number of cents, and the principal is reduced after some exact number of cents in interest is subtracted from the payment. All the little remainders are gone, and you start fresh for the next month -- which is why the last loan payment may differ by a penny or two from all the other payments.

    It's just one of those things you need to be aware of and compensate for when necessary.
    Last edited by shg; 08-12-2008 at 09:28 PM.

+ 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