Identifying duplicate location

markstro

Board Regular
Joined
Sep 8, 2008
Messages
106
Using this formula from another post, how can I identify the location of the duplicate entry??
=IF(COUNTIF(A2:$A$521,A2)>1,"DUPLICATE","")

I have identified a lot of duplicates, finding them is another problem.

I cannot simply sort and delete as each row has data I have to incorporate into one row before I delete the other.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi, Although not a Formula, this code will return all the Duplicate addresses in Column "A", in Column "C".
Code:
[COLOR="Navy"]Sub[/COLOR] MG03Dec34
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Q
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
ReDim ray(1 To Rng.Count)
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
[COLOR="Navy"]If[/COLOR] Not .Exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
.Add Dn.Value, Array(Dn.Address, "@")
[COLOR="Navy"]Else[/COLOR]
Q = .Item(Dn.Value)
    [COLOR="Navy"]If[/COLOR] Q(1) = "@" [COLOR="Navy"]Then[/COLOR]
        c = c + 1: Q(1) = c
        ray(Q(1)) = Dn.Value & " // " & Q(0) & "," & Dn.Address
    [COLOR="Navy"]Else[/COLOR]
        ray(Q(1)) = ray(Q(1)) & "," & Dn.Address
    [COLOR="Navy"]End[/COLOR] If
.Item(Dn.Value) = Q
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
Range("C1").Resize(c) = Application.Transpose(ray)
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
All formulas copied down. Perhaps column C or D may be useful to you. Note, though that if there are multiple duplications of the same value, this will only identify one of the matches.

Excel Workbook
ABCD
1ValueDuplicate?First DuplicateDuplicate Above
2aDUPLICATEMatch at row 9 
3bDUPLICATEMatch at row 5
4c
5bDUPLICATEMatch at row 13See row 3
6dDUPLICATEMatch at row 14
7e
8f
9aSee row 2
10g
11h
12i
13bSee row 3
14dSee row 6
15j
16
Duplicates
 
Upvote 0
Great solutions, before I received the answers I thought of just sorting by the column with all the duplicates, then conditional format each cell to change color if it matches the cell below. That way all the duplicates are together and I can then resort back to the original format.

Either way, I have to type and copy some formula or other. Thanks for all the help Mick, Mike & Peter. I will have to try them all and choose the easiest one to pass on to fellow employees.
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top