Remove Duplicate Data and Keep Unique in a separate sheet

gimran

New Member
Joined
Dec 15, 2011
Messages
33
Dear,

I have a data set among which there are many duplicate data and I want to find the unique data in separate sheet.

[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]1122[/TD]
[/TR]
[TR]
[TD]1133[/TD]
[/TR]
[TR]
[TD]1144[/TD]
[/TR]
[TR]
[TD]1155[/TD]
[/TR]
[TR]
[TD]1133[/TD]
[/TR]
[TR]
[TD]1122[/TD]
[/TR]
[TR]
[TD]1199[/TD]
[/TR]
[TR]
[TD]1133[/TD]
[/TR]
[TR]
[TD]1144[/TD]
[/TR]
[TR]
[TD]1100[/TD]
[/TR]
</tbody>[/TABLE]

Now I want the data to be like below:

[TABLE="width: 72"]
<colgroup><col width="72" style="width:54pt"> </colgroup><tbody>[TR]
[TD="class: xl63, width: 72, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]1122[/TD]
[/TR]
[TR]
[TD]1133[/TD]
[/TR]
[TR]
[TD]1144[/TD]
[/TR]
[TR]
[TD]1155[/TD]
[/TR]
[TR]
[TD]1199[/TD]
[/TR]
[TR]
[TD]1100[/TD]
[/TR]
</tbody>[/TABLE]

Please help me to do that.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Here is a vba sub:

Open/create a test workbook with a Worksheet which:
  • Has the data in it
  • Is named "Data"


A
Data

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]1122[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]1144[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1155[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]1122[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]1199[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]1144[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]1100[/TD]

</tbody>
Data

Put the following code into a module:
  • Get to vba editor Development tab > Visual Basic
  • Create a module Insert > Module
  • Cut and Paste the code into the module
Save the workbook

Run the macro UniqueList

Code:
Sub UniqueList()
    Sheets("Data").Copy after:=Sheets(1)
    Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row) _
            .AdvancedFilter Action:=xlFilterInPlace, Unique:=True
   
End Sub

Results in a new worksheet:

A
Data

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]1122[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]1144[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1155[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]1199[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]1100[/TD]

</tbody>
Data (2)
 
Upvote 0
Thanks for the reply, but is there any other process without macro and VBA.

Here is a vba sub:

Open/create a test workbook with a Worksheet which:
  • Has the data in it
  • Is named "Data"


A
Data

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]1122[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]1144[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1155[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]1122[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]1199[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]1144[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]1100[/TD]

</tbody>
Data

Put the following code into a module:
  • Get to vba editor Development tab > Visual Basic
  • Create a module Insert > Module
  • Cut and Paste the code into the module
Save the workbook

Run the macro UniqueList

Code:
Sub UniqueList()
    Sheets("Data").Copy after:=Sheets(1)
    Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row) _
            .AdvancedFilter Action:=xlFilterInPlace, Unique:=True
   
End Sub

Results in a new worksheet:

A
Data

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]1122[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1133[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]1144[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1155[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]1199[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]1100[/TD]

</tbody>
Data (2)
 
Upvote 0
Here are two ways (formulas) to extract unique items. Hope this helps.


Excel 2012
ABCDE
111221122Unique
2113311331122
3114411441133
4115511551144
5113311991155
6112211001199
711991100
81133
91144
101100
Sheet1
Cell Formulas
RangeFormula
C1{=IFERROR(INDEX($A$1:$A$10,SMALL(IF(FREQUENCY(IF($A$1:$A$10<>"",MATCH($A$1:$A$10,$A$1:$A$10,0)),ROW($A$1:$A$10)-ROW($A$1)+1),ROW($A$1:$A$10)-ROW($A$1)+1),ROWS($C$1:C1)))," ")}
E2{=IFERROR(INDEX($A$1:$A$10,MATCH(0,COUNTIF($E$1:E1,$A$1:$A$10),0))," ")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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