SOLVED

Help: Highlighting Only the First Duplicate

Copper Contributor

I have two columns of data. I'm comfortable with conditional logic and I've made the data consistent between the two columns so that highlighting duplicates is error-proof.

 

Here's where it gets bumpy: In Column B, I only need to highlight the FIRST instance of a duplicate value that exists in Column A. If that doesn't make sense, I don't know of any other way to explain it.

 

Current Situation:

Current SituationCurrent Situation

 

Desired Outcome:

Desired OutcomeDesired Outcome

 

 

ALTERNATE SOLUTION:

 

I'll also accept the inverse scenario as it could be easy to filter: In Column B, highlight any duplicate (beyond the first) of a value that exists in Column A.

15 Replies

@Daniel Edgerton 

You may apply conditional formatting rule like

image.png

best response confirmed by Daniel Edgerton (Copper Contributor)
Solution

@Daniel Edgerton 

Select B1:B9 (or to the end of the data). B1 should be the active cell in the selection.

Create a rule of type 'Use a formula to determine which cells to format' with formula

 

=AND(ISNUMBER(MATCH(B1,A:A,0)),COUNTIF(B$1:B1,B1)=1)

 

S1305.png

@Hans Vogelaar  - I tested it with the sample text, and it works. But I'm having difficulty applying it to my project. The columns contain email addresses along with some appended (concatenated) text to serve as a unique identifier.

 

Originally, I had an asterisk between the date (first 8 characters) and the email. I thought it might be interfering, so I replaced it with "ZZZ" and can remove it later. I then thought the "@" was the problem, so I replaced that with "XXX" and can remove that later. Regardless, the formula you suggested should work here, right? It doesn't, and I can't figure out why not. 

 

In writing this, I also replace the period in ".com" just to see. Nothing. Still doesn't work. It's just text, so why isn't it being recognized as a match? 

 

Screen Shot 2022-04-18 at 9.30.49 AM.png

@Daniel Edgerton 

Could you attach a sample workbook, or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?

Weird. It's working now. I have no idea what's stopping it elsewhere.

@Daniel Edgerton 

Thanks! This is what I see when I download and open your workbook:

S1308.png

The conditional formatting rule appears to work as intended.

Again, this is just sample text. The working file has 328 rows in Column A and 631 in Column B. No other changes to the formula, and still nothing is highlighting.

@Daniel Edgerton 

At least in your sample rule is applied only to the range B1:B161, not to entire range

image.png

Corrected. I was actively expanding the data to a range that matched my working file.

@Daniel Edgerton 

So, now it works?

It seems to work in the sample file. Can't get it to work in the real one.
It's working now. I found the error. Thank you both!

@Daniel Edgerton 

Great to know you sorted this out.

@Daniel Edgerton 

Just for the sake of it, a slightly different approach to identifying the first occurrence of each string.

Because CF is a pile of antiquated functionality, one is forced to use relative referencing rather than array formulas.  First I provided a name for the current cell, which I show in R1C1 notation whereas A1 notation would give me any one of 17 billion ways of writing the same thing.

currentCell = Sheet1!RC;

firstInstance? 
= ISREF(
     currentCell  XLOOKUP(currentCell, sessions, sessions)
  );

The Boolean Named Formula firstInstance? looks up the current cell value in the list of sessions and returns a reference to the first occurrence.  If that reference and the current cell are one and the same, the argument of ISREF( ) will be the reference, otherwise a NULL error, giving TRUE/FALSE.  The formatting depends upon firstInstance?

 

image.png

1 best response

Accepted Solutions
best response confirmed by Daniel Edgerton (Copper Contributor)
Solution

@Daniel Edgerton 

Select B1:B9 (or to the end of the data). B1 should be the active cell in the selection.

Create a rule of type 'Use a formula to determine which cells to format' with formula

 

=AND(ISNUMBER(MATCH(B1,A:A,0)),COUNTIF(B$1:B1,B1)=1)

 

S1305.png

View solution in original post