• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to create unique list based on data available in range of cells

tonaveenv

New Member
How can I get the list in B1 based on data available in A1 to A10. In A1 to A10 data may be duplicate but in the list I should get the unique values.


A1:A10

kiran

naveen

ram

uma

ram

ravi

naveen

raju

kiran

lalith


B1 drop down list should come as below

kiran

naveen

ram

uma

ravi

raju

lalith
 
Hi tonaveenv,


May be there are some other ways in excel to do this, but we may achieve your need with little help of VBA. Put the following code in the excel file where you have the list in Column A and run it. [Copy the code below, go to your excel file, hit Alt+F11, this will open the Visual Basic Window, hit Alt+I+M, a blank module will appear, hit Ctrl+V and to run the code hit F5]. If all goes fine, you should get the list according to your requirement at B1.

Please note that I am assuming your list at column A, does not have any header. If it does, make a little change in the formula in the code below:

instead of "=OFFSET($F$1,0,0,COUNTA($F:$F))", put "=OFFSET($F$1,1,0,COUNTA($F:$F))"

And also please note that I have used column F as helping column.


Sub MakeUniqueNameList()

Application.ScreenUpdating = False

Columns("A:A").Select

Range("A1:A12").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _

"F1"), Unique:=True

Range("B1").Select

With Selection.Validation

.Delete

.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _

xlBetween, Formula1:="=OFFSET($F$1,0,0,COUNTA($F:$F))"

.IgnoreBlank = True

.InCellDropdown = True

End With

Columns("F:F").Select

With Selection.Font

.ThemeColor = xlThemeColorDark1

.TintAndShade = 0

End With

Range("B1").Select

Application.ScreenUpdating = True

End Sub
 
Excel 2003


On the Excel menu, go to Data, Filter, Advanced Filter, select your list (A1:A10 in your example), click "Unique records only" and select the place where you want the answer to appear.
 
Hi ,


You can use the following array formula ( entered using CTRL SHIFT ENTER ) in B1 , and copy it down :


=IFERROR(INDEX(List_with_duplicates,SMALL(IF(FREQUENCY(MATCH(List_with_duplicates,List_with_duplicates,0),MATCH(List_with_duplicates,List_with_duplicates,0))>0,ROW(INDIRECT("1:"&ROWS(List_with_duplicates)))),ROWS($1:1))),"")


where List_with_duplicates is your range , say $A$1:$A$10.


Narayan
 
Back
Top