+ Reply to Thread
Results 1 to 5 of 5

if formula showing as incorrect when it is correct

  1. #1
    Registered User
    Join Date
    09-22-2021
    Location
    shropshire england
    MS-Off Ver
    ms office 365
    Posts
    2

    if formula showing as incorrect when it is correct

    Spread sheet that is checking if the total in column J is the same as tab "kit"
    Attached Files Attached Files
    Last edited by rich1407; 09-22-2021 at 11:49 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: if formula showing as incorrect when it is correct

    Try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    When doing a direct comparison of two values that are the result of mathematical manipulation, it's best to round those values because there may be slight inaccuracies (out to the 15th decimal place) due to the fact that computers calculate using binary and we calculate in a decimal system. Hope that helps.

    The value in kit H30 (for the record) is -52.5999999999998.
    Last edited by ChemistB; 09-22-2021 at 11:42 AM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,192

    Re: if formula showing as incorrect when it is correct

    Rounding errors ..

    Try

    =IF(ROUND(kit_1,2)=ROUND(kit_2,2),"Correct","errror")

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: if formula showing as incorrect when it is correct

    You have two solutions for this (that are the same) so I will take a minute to explain the problem.

    When dealing with real numbers on computer, some numbers cannot be represented exactly. (Think of how you would write 2/3 as a decimal number--you can't write it exactly because the 6 would go on forever. So it usually ends up rounded with the final digit being 7.)

    When you do arithmetic with real numbers on a computer, even if you think two numbers should be the same, they might not be. This gets complicated so I won't explain the technical details, but here are the two numbers you are comparing. These are the actual values, although your formatting is rounding the numbers to two decimal places. You can see if you go out to the 13th place, they are not the same (Excel only maintains 15 significant digits).

    Download!J250 = -£52.5999999999999

    Kit!H30 = -£52.5999999999998

    The general rule is that whenever you are comparing two real numbers for equality, you must round to the precision of interest get a meaningful result. In this case you need to round to the nearest pence.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    09-22-2021
    Location
    shropshire england
    MS-Off Ver
    ms office 365
    Posts
    2

    Re: if formula showing as incorrect when it is correct

    Thank you that has worked , i had been looking at this for hours!!!

+ 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] Three correct Formula giving incorrect result when put together
    By Marvo in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-25-2019, 03:09 PM
  2. Copy cell copies correct formula, but displays incorrect values
    By willzzzzzzzz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-10-2016, 05:28 PM
  3. Basic Formula showing incorrect result
    By jane1613 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-01-2014, 06:50 PM
  4. Replies: 3
    Last Post: 06-14-2013, 12:55 PM
  5. Formula not showing correct format
    By TheLeafs in forum Excel General
    Replies: 4
    Last Post: 04-19-2011, 09:12 PM
  6. Formula not showing the correct percentage...
    By Steve-B in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-03-2008, 11:27 AM
  7. [SOLVED] A correct formula gives an incorrect figure
    By GarMcCas in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-17-2006, 06:55 PM

Tags for this Thread

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