Forum Discussion

thumy's avatar
thumy
Copper Contributor
Mar 24, 2020

Using COUNTIF for conditional formatting, works for some cells but not others

I am trying to compare two lists of 13-digit book ISBNs (my inventory and a publishers inventory), and want the ISBN highlighted on my list if it appears on the publisher's list. 

 

My problem is that the conditional formatting works on most cells but not all and I can't figure out why. There are ISBNs on my list that aren't highlighted even though I can easily find them on the publisher's list using Find.

 

I have tried:

  • CLEANing the data of weird characters
  • TRIMing the data to remove unwanted white space
  • Matching the format type on the columns being compared (tried Text, Number, General) even though COUNTIF doesn't care about that
  • Replacing the data with plain text just in case there were encoding issues
  • Copying the relevant columns onto new sheets and into new Excel files in case files had been corrupted

I don't think the problem is my formula since it works 90% of the time, but I am using this:

 

=COUNTIF(PubList!$B:$B, B2)

 

where Publist is the name of the sheet I'm searching, $B is the column on that sheet, and B2 is the first cell on my own list that I want to check. 

 

I have been banging my head against this all day and cannot figure out what I'm doing wrong. Any help (or alternative ways to highlight duplicates) would be greatly appreciated.

1 Reply

  • Savia's avatar
    Savia
    Iron Contributor

    thumy Find an ISBN that you think should be formatted and the cell in the publisher's list, and do an =A1=B1 style comparison formula.  Excel should say TRUE if they truly are equal.

     

    Numbers and text aren't seen as the same so that's one possibility.  Excess spaces you probably covered with TRIM already.  Leading 0s don't stay unless things as formatted as text, that could be happening.  Really without seeing the data I can only make generic suggestions.

Resources