Compare 4 columns to find duplicate rows and copy one column data from all duplicate rows

pacchiee

New Member
Joined
Sep 1, 2016
Messages
2
IDFirst NameLast NameStateReference
1MarkBrownCA2257849635
2ShawnJackCA2245787962
3SmithBlackCA7789654123
4MarkBrownCA2257849635
5SmithBlackCA7789654123
6MarkBrownCA2257849635

<tbody>
</tbody>

I have huge data (10,00,000 rows) in the above format. Need to find all the IDs having duplicate content.

For example, the rows 1, 4 and 6 has same data; similarly 3 & 5 are duplicate rows.

Wanted a macro to do the following:
1. Delete all unique rows contents except ID.
2. Find duplicate rows and paste the IDs of duplicate rows next to the Reference column. Like "4,6" for "1".
3. Delete all the contents of duplicate rows except ID.


Finally, the sheet should look like this:
IDFirst NameLast NameStateReference
1MarkBrownCA22578496354,6
2
3SmithBlackCA77896541235
4
5
6

<tbody>
</tbody>

I tried other manual methods, but due to huge data the file freezes. I know nothing about macros to write one. Please help me with this. Thank you.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Do you need to compare all 4 columns or id the reference unique to the person. If not do you have another column with a unique reference per person?
 
Upvote 0
The only unique data is ID. Chances are there that all other 4 columns are similar. Hence, we need to compare all 4 columns to find duplicate rows.
 
Upvote 0
I can't write macro's for you, not my thing.

Assmue your data is in A1:E7;

Insert 2 now columns at A
B2 =CONCATENATE(D2,E2,F2,G2,)
A2= =COUNTIF(B$1:B4,B4)




Its importatnt to note that the B1 in A2 is anchored with $.

Copy the formula's down and filter anything that isn't a one in column A and clear the contents of cells D:G

Good luck


<tbody>
</tbody><colgroup><col></colgroup>
 
Upvote 0

Forum statistics

Threads
1,214,397
Messages
6,119,271
Members
448,882
Latest member
Lorie1693

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