Apr 15 2022 02:22 PM
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:
Desired 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.
Apr 15 2022 02:43 PM
Apr 15 2022 02:50 PM
SolutionSelect 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)
Apr 18 2022 06:36 AM
@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?
Apr 18 2022 06:39 AM
Could you attach a sample workbook, or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?
Apr 18 2022 07:00 AM
Apr 18 2022 07:02 AM
Thanks! This is what I see when I download and open your workbook:
The conditional formatting rule appears to work as intended.
Apr 18 2022 07:10 AM
Apr 18 2022 07:21 AM
At least in your sample rule is applied only to the range B1:B161, not to entire range
Apr 18 2022 07:25 AM
Apr 18 2022 07:28 AM
So, now it works?
Apr 18 2022 07:29 AM
Apr 18 2022 07:33 AM
Apr 18 2022 07:49 AM
Great to know you sorted this out.
Apr 18 2022 09:16 AM
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?
Apr 15 2022 02:50 PM
SolutionSelect 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)