Filtering Unique records

chiswickbridge

Board Regular
Joined
Feb 2, 2013
Messages
130
My data is as follows...6 columns....Duplicate data in col A and col D....need to be attended to
[TABLE="width: 500"]
<tbody>[TR]
[TD]AAA[/TD]
[TD]xxx[/TD]
[TD]yyy[/TD]
[TD]USD[/TD]
[TD]zzz[/TD]
[TD]www[/TD]
[TD][/TD]
[TD][/TD]
[TD]AAA[/TD]
[TD]USD[/TD]
[/TR]
[TR]
[TD]BBB[/TD]
[TD]abc[/TD]
[TD]swe[/TD]
[TD]INR[/TD]
[TD]wed[/TD]
[TD]fde[/TD]
[TD][/TD]
[TD][/TD]
[TD]AAA[/TD]
[TD]CAN[/TD]
[/TR]
[TR]
[TD]CCC[/TD]
[TD][/TD]
[TD][/TD]
[TD]CAN[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]AAA[/TD]
[TD]INR[/TD]
[/TR]
[TR]
[TD]DDD[/TD]
[TD][/TD]
[TD][/TD]
[TD]USD[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]BBB[/TD]
[TD]INR[/TD]
[/TR]
[TR]
[TD]EEE[/TD]
[TD][/TD]
[TD][/TD]
[TD]ROU[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]BBB[/TD]
[TD]SRT[/TD]
[/TR]
[TR]
[TD]BBB[/TD]
[TD][/TD]
[TD][/TD]
[TD]SRT[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]CCC[/TD]
[TD]CAN[/TD]
[/TR]
[TR]
[TD]CCC[/TD]
[TD][/TD]
[TD][/TD]
[TD]MYN[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]CCC[/TD]
[TD]MYN[/TD]
[/TR]
[TR]
[TD]AAA[/TD]
[TD][/TD]
[TD][/TD]
[TD]CAN[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]DDD[/TD]
[TD]USD[/TD]
[/TR]
[TR]
[TD]AAA[/TD]
[TD][/TD]
[TD][/TD]
[TD]INR[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]DDD[/TD]
[TD]INR[/TD]
[/TR]
[TR]
[TD]DDD[/TD]
[TD][/TD]
[TD][/TD]
[TD]INR[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]EEE[/TD]
[TD]ROU[/TD]
[/TR]
</tbody>[/TABLE]

Since the data set runs in 50,000 rows, I need a VBA to select Unique records of A and paste them in Col I and the corresponding unique records from Col D pasted in Col J.
AAA - has 3 unique records
BBB - has 2 unique records
CCC - has 2 unique records

Thanks.....
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try:

Code:
Sub Macro()
    Range("A:A,D:D").Copy Range("I1")
    u = Range("I" & Rows.Count).End(xlUp).Row
    ActiveSheet.Range("I1:J" & u).RemoveDuplicates Columns:=Array(1, 2), Header:=xlNo
End Sub
 
Upvote 0
Thank You....Dante....What more can I say.....Lovely VBA in a short script.....FANTASTIC

Any tips on which book to use for VBA learning....or is it hands-on ?.....Would love to be like you...
 
Upvote 0
Hi Dante.....What changes do I need to do... if I plan to startsaving my data from A10 to M10

I intend leaving the top 9 rows for placing icons and some cells for tabulations...
 
Upvote 0
Try:

Code:
Sub Macro()
    u = Range("A" & Rows.Count).End(xlUp).Row
    Range("A10:A" & u & ",D10:D" & u).Copy Range("I10")
    u = Range("I" & Rows.Count).End(xlUp).Row
    ActiveSheet.Range("I10:J" & u).RemoveDuplicates Columns:=Array(1, 2), Header:=xlNo
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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