+ Reply to Thread
Results 1 to 31 of 31

Formula anomaly

  1. #1
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Formula anomaly

    1 A B C D E F
    2 What is wrong with the following?
    3 The totals for these two sets of figures are the same - or are they
    4 If you subtract one from the other using the simplest of formulas the answer is precisely zero
    5 But if you introduce brackets into the formula the answer is not quite zero. How is that possible?
    6
    7 enter: 0.7 0.7
    8 enter: 0.7 0.7
    9 enter: 0.7 0.7
    10 enter: 0.0 0.7
    11 enter: 1.4 0.7
    12 Totals 3.5 3.5
    Difference between 2 totals: 0.000000000000000000000 using formula: =B12-C12
    -0.000000000000000444089 using formula: =(B12-C12)

    If you alter the original figures the anomaly usually disappears.
    If you enter the same figures and formulas in a new spreadsheet the same thing happens.
    I have Excel 2013 but I have tried the same thing in 2007 and 2016 versions with same result
    See attachment for clearer explanation
    Last edited by Mulpuzzle; 07-28-2016 at 06:13 AM. Reason: Improve presentation

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Formula anomaly

    You've left out some of the formulas, how do you get 3.5 ? Or 1.4 ?
    Post ALL the formulas you're using, not just some of them
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula anomaly

    Out of time
    Last edited by José Augusto; 07-28-2016 at 05:41 AM. Reason: Out of time

  5. #5
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    AliGW: Thanks. Didn't know I could do that

  6. #6
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    Special-K: I had some difficulty with presentation. Have now added attachment, as suggested by AliGW

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    No file attached!!!

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Formula anomaly

    Did you enter those numbers, or are they the results of other formulae/imported from another file?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  9. #9
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    Glenn Kennedy: The numbers are just entered. Try them.

  10. #10
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Formula anomaly

    I get correct values when I do it. You probably have something formatted wrong or some other variable that is causing the discrepancy.
    For example, those values might be what are displaying, but you could have it formatted to display only one decimal, when it is actually storing far more. There's a lot of reasons why this could happen, but without your workbook, we can't really tell.

    Please follow the directions in post #2 so we can help you.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Formula anomaly

    I did. No issues here...
    Attached Files Attached Files

  12. #12
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula anomaly

    Hi Gleen

    @Mulpuzzle is right.
    Using your file 'Numbers.xls' change A4 to zero end B5 to 0.7 and see de difference.
    Last edited by José Augusto; 07-28-2016 at 07:20 AM.

  13. #13
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    Glenn Kennedy: You've got the figures wrong. The right hand column should be 0.7 in each of the 5 rows. See attached.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Quote Originally Posted by Mulpuzzle View Post
    Glenn Kennedy: You've got the figures wrong. The right hand column should be 0.7 in each of the 5 rows. See attached.
    Malpuzzle - you still have not attached your copy of the file. That is why people are having to recreate the data for you, and that is not necessary. Please do as I asked in post #2.

  15. #15
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    TheN: I don't know why you get correct values and I don't think your suggested answers are correct. Here's my spreadsheet.

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Quote Originally Posted by Mulpuzzle View Post
    TheN: I don't know why you get correct values and I don't think your suggested answers are correct. Here's my spreadsheet.
    WHERE is your spreadsheet? You still haven't attached it!

  17. #17
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    AliGW: I seem to be having trouble with attachments - lack of understanding no doubt! Try this

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Here are the instructions again:

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    DON'T try to use the paper clip - it doesn't work.

  19. #19
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula anomaly

    Hi
    I can resume the problem
    =A6-B6
    =(A6)-B6
    =A6-(B6)
    =(A6-B6)
    The first three formulas give zero but the latter does not.

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Quote Originally Posted by José Augusto View Post
    Hi
    I can resume the problem
    =A6-B6
    =(A6)-B6
    =A6-(B6)
    =(A6-B6)
    The first three formulas give zero but the latter does not.
    OK, so can you provide a sample file then, please?

  21. #21
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula anomaly

    Hi @AliGW
    Here it is.
    Attached Files Attached Files

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Thanks. I can replicate the problem here, too.

    =(B6-A6) results in the same number, but positive.

  23. #23
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    So now that some of you have confirmed this peculiar anomaly where do we go from here? Is it time to tell Microsoft "sorry guys there's a fault in Excel. It's integrity is fatally undermined."?

  24. #24
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,366

    Re: Formula anomaly

    Quote Originally Posted by Mulpuzzle View Post
    So now that some of you have confirmed this peculiar anomaly where do we go from here? Is it time to tell Microsoft "sorry guys there's a fault in Excel. It's integrity is fatally undermined."?
    Yep - looks like it! What do you think we should do? I mean, there is nothing wrong per se with the formulae you are using, so use one that currently gives the answers you need.

  25. #25
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula anomaly

    Do a Google search on Jerry Lewis Excel floating point errors.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  26. #26
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: Formula anomaly

    No, this is not an excel error, it has to do with how all computers handle the floating point situation. If you google it, you will get a bunch of hits, here is the text from just 1 of tghem...
    The most common situation is illustrated by the decimal number 0.1. Although it has a finite decimal representation, in binary it has an infinite repeating representation. Thus when = 2, the number 0.1 lies strictly between two floating-point numbers and is exactly representable by neither of them.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  27. #27
    Registered User
    Join Date
    07-28-2016
    Location
    Hereford, England
    MS-Off Ver
    2013
    Posts
    9

    Re: Formula anomaly

    OK, thanks to Tony Valko and FDibbins I have now found enlightenment on floating point errors. As anticipated I have not accidentally discovered an anomaly which no one had found before. Shame! I still have a problem though. I discovered this "error" when using conditional formatting. I wanted a certain figure to turn red if two other figures were not the same and of course a very minute difference means they are not the same. I can solve this by building in a small tolerance to the formula but it seems amazing that this should be necessary. I have been using this simple formula for years and never had a problem before. Is there a simpler way?

  28. #28
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula anomaly

    Quote Originally Posted by Mulpuzzle View Post
    it seems amazing that this should be necessary.
    I agree but that's the reality of the situation.

    Is there a simpler way?
    Rounding is the best option.

  29. #29
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Formula anomaly

    It is not a anomaly. Microsoft Excel retains 15 significant digits
    See this https://support.microsoft.com/en-us/kb/65903

    The question is more like "which is the difference between these two group of expressions?" Is not the same? Why?
    =A6-B6 or =(A6)-(B6) or =A6-(B6) or =(A6)-B6
    and
    =(A6-B6) or =((A6)-(B6)) or =(A6-(B6)) or =((A6)-B6)

    If I use in D6 =A6-B6 and in E6 =D6=0 and I get TRUE in E6
    So, why I get FALSE if I use =(A6-B6)=0 ?

  30. #30
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Formula anomaly

    Here's an attachment demonstrating the problem now...

    It worked with just the values for me, but if you use the sum function to get the values, it breaks.
    Attached Files Attached Files

  31. #31
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: Formula anomaly

    As Tony pointed out, the best way around this is to use rounding, just select the number of decimals you are willing to work with

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula to detect anomaly in data entered in excel sheet
    By crimson_wolf in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-24-2013, 01:46 AM
  2. quantitative anomaly-- inconsistent values, help me find formula error!
    By mtmorce in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-21-2013, 03:27 PM
  3. IF function anomaly
    By BBS in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-07-2007, 11:51 AM
  4. DATEDIF anomaly?
    By cruisy in forum Excel General
    Replies: 5
    Last Post: 05-25-2007, 12:10 AM
  5. Printing Anomaly
    By Otto Moehrbach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2005, 11:05 AM
  6. Formatting Anomaly
    By Christopher Weaver in forum Excel General
    Replies: 2
    Last Post: 05-13-2005, 06:06 PM
  7. VLOOKUP Anomaly
    By Tosca in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-08-2005, 05:08 AM

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