Ignoring Duplicate entries from drop down list

Frisbee Dog

New Member
Joined
Aug 12, 2009
Messages
1
I have a data list where a user can select a value. This list is linked to a separate file which is changed often.

I am using a drop down list box via data validation. Currently, the code I have below works great, as it ignores values that are blank. But, sometimes duplicate entries appear. I would like one of the duplicate to show, but the other to be ignored. I can't figure out how to do this. Please help. Thanks.

Code:
=OFFSET(C331,0,0,COUNTIF($C$331:$C$525,">"""),1)
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Your formula DON'T ignore empty cells when they are inside the list.
A possibility could be to use another list prepared from the first one where all duplicate and empty cells are removed.
Assuming :
data in A2:A8
the second list in D2:D8
Put next formula (coming from someone in this forum) in D2, confirm using CONTROL + SHIFT + ENTER (Area formula)
Copy D2 and drop down
=IF(ROWS(D$2:D2)<=C$2,INDEX(A$2:A$8,SMALL(IF(FREQUENCY(IF(A$2:A$8<>"",MATCH("~"&A$2:A$8,A$2:A$8&"",0)),ROW(A$2:A$8)-ROW(A$2)+1),ROW(A$2:A$8)-ROW(A$2)+1),ROWS(D$2:D2))),"")
 
Upvote 0
Or prepare a macro to filter
The first cell where to put filtered data is named = Extract_List
The HEADER where to pick up data is named = Type
Code:
Option Explicit
Sub List_Unic_Prepa()
Dim I As Long, J As Long
Dim LASTROW As Long
Dim MyRG As Range
Dim MyCOL As Integer
Dim MyROW As Long
'---------   CLEAR  PREVIOUS  CONTENTS    ----------
    Range(Range("EXTRACT_LIST").Offset(1, 0), Range("EXTRACT_LIST").End(xlDown)).ClearContents
'---------   COLLECT  DATA    ----------
    MyROW = Range("TYPE").Row
    MyCOL = Range("TYPE").Column
    LASTROW = Cells(Rows.Count, MyCOL).End(xlUp).Row
    J = 1
    For I = MyROW + 1 To LASTROW
        Set MyRG = Range(Range("Type"), Cells(I, MyCOL))
        If (WorksheetFunction.CountIf(MyRG, Cells(I, MyCOL)) = 1) Then
            Range("EXTRACT_LIST").Offset(J, 0) = Cells(I, MyCOL)
            J = J + 1
        End If
    Next I
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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