+ Reply to Thread
Results 1 to 10 of 10

Excel sees non-identical values as identical

  1. #1
    Registered User
    Join Date
    12-18-2019
    Location
    Belgium
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    4

    Excel sees non-identical values as identical

    In the attached workbook, Excel says the cells "5 - 9" and "5-9" are identical while they are obviously not. It does the same thing for "2-4" and "2 - 4", but not for "15-19" and "15 - 19".

    The problem only occurs in column B, not in column A, while I don't see the difference between the two columns.

    What am I missing here?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Excel sees non-identical values as identical

    I don't see any indication of the problem that you describe in your attachment.

    What formula or operation are you using when you believe that "5 - 9" (B5) is identical to "5-9" (B8), for example?

    =B5=B8 returns FALSE

    Data > Filter shows only B5, B10, B15, B16 and B18 when I select "5 - 9", and only B8 when I select "5-9".

    Please provide an Excel file that demonstrates the problem, with the problem shown, if possible, or at least with step-by-step instructions that allow us to duplicate the problem.

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Excel sees non-identical values as identical

    The highlight duplicates functionality seems to work similarly to functions like COUNTIF in that it will treat anything that could be considered a number (including dates) as a number. In this case I assume it is coercing 5-9 to a date (either 5th Sept or 9th May depending on your region). That's why it doesn't happen with 15-19.
    Rory

  4. #4
    Registered User
    Join Date
    12-18-2019
    Location
    Belgium
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    4

    Re: Excel sees non-identical values as identical

    I selected cells B5 (5-9) and B8 (5 - 9) and then colored duplicate values. As you can see in the file the cells are colored. When I use the countif formula, it says "5 - 9" occurs 6 times while it only occurs 5 times.

  5. #5
    Registered User
    Join Date
    12-18-2019
    Location
    Belgium
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    4

    Re: Excel sees non-identical values as identical

    How can I fix this? I already put a ' in front of the values so that Excel wouldn't change them to a date. Is there another way to make sure these values are not seen as dates?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Excel sees non-identical values as identical

    Not with the highlight duplicates function, as far as I know. You could use a helper column (or CF) formula with SUMPRODUCT, like this:

    =SUMPRODUCT(--($B$2:$B$27=B2))

  7. #7
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Excel sees non-identical values as identical

    [.... deleted ....]

    I think rorya has hit upon the problem, to wit: COUNTIF is interpreting "5-9" and "5 - 9" as dates, thereby comparing everything as numeric dates.
    Last edited by joeu2004; 12-18-2019 at 11:27 AM.

  8. #8
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Excel sees non-identical values as identical

    FYI, changing COUNTIF($B$2:$B$27,B5) to COUNTIF($B$2:$B$27,"*" & B5) forces COUNTIF to do a string comparison. It produces the intended results.

  9. #9
    Registered User
    Join Date
    12-18-2019
    Location
    Belgium
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    4

    Re: Excel sees non-identical values as identical

    Thank you both so much!

  10. #10
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Excel sees non-identical values as identical

    Quote Originally Posted by joeu2004 View Post
    FYI, changing COUNTIF($B$2:$B$27,B5) to COUNTIF($B$2:$B$27,"*" & B5) forces COUNTIF to do a string comparison
    But on second thought, that is a __bad__ work-around because it allows for counting "xxx5 - 9" as well. Maybe not a problem in the immediate situation; but problematic, in general.

    I would use the SUMPRODUCT work-around, because it is predictable.

+ 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] Identical Formulas from Identical Data Sets Return Different Results
    By EverClever in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-28-2018, 06:56 PM
  2. Adding Multiple Identical tables to a Master Identical table
    By dlogfx in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-24-2017, 04:41 PM
  3. [SOLVED] Identical Text not identical (for =, vlookup, etc) MAKING ME CRAZY
    By jnt in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-22-2015, 09:57 PM
  4. Identical worksheets, identical data, different arrangements
    By Hooty in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-21-2012, 05:02 PM
  5. Replies: 4
    Last Post: 11-03-2012, 12:02 PM
  6. Replies: 4
    Last Post: 01-25-2012, 05:49 PM
  7. Replies: 1
    Last Post: 01-20-2012, 12:52 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