how to do in excel

  • Thread starter Thread starter M.K
  • Start date Start date
M

M.K

hi all

if i have the following coulm

26
26
22
23
24
26
25
24
12

i want formule to remove duplicate so the result will be as following

26
22
23
24
25
12

and other formule if it is possible to give result from less number to
biggest with remove duplicate as following

12
22
23
24
25
26



Thank you
 
If not column A then change mc=1. Adjust if you don't want to delete ROW

Option Explicit
Sub SortanddeldupsSAS()
Dim mc As Long
Dim lr As Long
Dim i As Long

mc = 1 'column A
lr = Cells(Rows.Count, mc).End(xlUp).Row
Range(Cells(1, mc), Cells(lr, mc)).Sort Key1:=Cells(1, mc), _
Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
For i = lr To 2 Step -1
If Cells(i - 1, mc) = Cells(i, mc) Then Rows(i).Delete
Next i
End Sub
 
M.K
... remove duplicate ... <

In Excel 2003, Data | Filter | Advanced Filter, Copy to another location,
Unique records only

In Excel 2007, Data ribbon | (Sort & Filter section) Advanced | etc.
... from less number to biggest ... <

In Excel 2003, Data | Sort, Ascending

In Excel 2007, Data ribbon | (Sort & Filter section) "A down to Z"

- Mike
http://www.MikeMiddleton.com
 
Back
Top