Excel Question (Macro, Vlookup, other method?): Same name highlighting

max347

Platinum Member
Oct 16, 2007
2,335
6
81
Hi guys, I have a column of names in A column, and a column of names in B column. I need to highlight (or put into a third column) the duplicates. The catch- one column is in "first last" format and the other is in "last, first" format.

Ideas?

Thanks!
 

Zorander

Golden Member
Nov 3, 2010
1,143
1
81
Assuming clean formatting of the names, can you break up one of the columns using Text-to-Column, then recombine them to match the other column's format (using Concatenate or simply using "&" functions)?

Once you have the 2 columns matching in format, you can use the "if" function in column C to highlight any matching rows, e.g. IF(A2=B2,"DUPLICATE","").
 
Last edited:

max347

Platinum Member
Oct 16, 2007
2,335
6
81
Unfortunately the one column is severely non-formatted. ie, different spacing, some have jr, sr, ms, etc.

I will check out this method and see what I can come up with however.

I was checking out the fuzzy sort thing by microsoft however it just seems like a way to do database style tie-togethers...not really a sort.
 

max347

Platinum Member
Oct 16, 2007
2,335
6
81
Yeah so this is what I was trying to use, but unfortunately it won't work with "similar" names, just exact matches-

Code:
Sub ColorDuplicates()
'Color duplicate items between columns A and B
    For i = 1 To Range("B65536").End(xlUp).Row
         If Application.WorksheetFunction.CountIf(Range("A:A"), Range("B" & i)) = 1 Then
            With Range("B" & i).Font
                .ColorIndex = 3
                .Bold = True
            End With
         End If
    Next i
    For i = 1 To Range("A65536").End(xlUp).Row
         If Application.WorksheetFunction.CountIf(Range("B:B"), Range("A" & i)) = 1 Then
            With Range("A" & i).Font
                .ColorIndex = 3
                .Bold = True
            End With
         End If
    Next i
End Sub