Validation list to show unique items only

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
I am using col A as the source list for Data validation list. In col A some items repeat more than once. The problem is that the list also shows the items as appearing in the col A ie if item "A" is appearing for more than once, in the list also it is appearing more than once.

I want that the list should not show an item more than once.

How this can be done?

A snapshot is given below:
Book4
ABCD
1ASelect at C1A
2B
3CName = mylist
4AName range formula
5C=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A))
6D
7FProblem: Cell A1 is the data\validation\list
8BSource: mylist
9EThe list at Cell A1 shows duplicates also
10Fie A is showing for the times it is in the col A
11RI want that the list should show only
12Tunique items ie all the items in the list once.
13S
Sheet1
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Create a distinct items list on Sheet1, from items in column A. The distinct items list should then become the source for data validation.
 
Upvote 0

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
This cannot be done as It is a part of an overall project and also the items list will not end here new data and items will be added frequently then making such a list separately is not possible.

So I want to make a formula from the existing list so that validaiton list will show only unique items.
 
Upvote 0

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
This cannot be done as It is a part of an overall project and also the items list will not end here new data and items will be added frequently then making such a list separately is not possible.

So I want to make a formula from the existing list so that validaiton list will show only unique items.

Alas, the dinner cannot be served the way you wish... You could of course search the board for a VBA solution.

Are you on Excel 2003?
 
Upvote 0

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Excel 2003
Book3
ABCD
16
2ItemsDistinct Items
3fgafga
4dfsdfs
5gdagda
6gdatra
7tratur
8dfswra
9tur 
10wra 
11
Sheet1


Select the current range A2:B10 and activate Data|List|Create List in order to convert the range into a list. Now you are free to add new items at the insertion point (indicated with *) in column A.

B1:

Control+shift+enter...

=SUM(IF(FREQUENCY(IF(A3:A10<>"",MATCH("~"&A3:A10,A3:A10&"",0)),ROW(A3:A10)-ROW(A3)+1),1))

B3:

Control+shift+enter...

=IF(ROWS($B$3:B3)<=$B$1,INDEX($A$3:$A$10,SMALL(IF(FREQUENCY(IF($A$3:$A$10<>"",MATCH("~"&$A$3:$A$10,$A$3:$A$10&"",0)),ROW($A$3:$A$10)-ROW($A$3)+1),ROW($A$3:$A$10)-ROW($A$3)+1),ROWS($B$3:B3))),"")

and copy down.

MyList (for data validation) is defined by:

=OFFSET(Sheet1!$B$3,0,0,Sheet1!$B$1)
 
Upvote 0

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
But this is also using separate column for which I am facing difficulty. Else, can this be made through macro?
 
Upvote 0

Krishnakumar

Well-known Member
Joined
Feb 28, 2003
Messages
2,615
Hi,

Draw a combobox from Control Toolbox.

Paste this code in the sheet module.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim a, v, z
If Target.Column <> 1 Then Exit Sub
a = Range("a1", Range("a" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
    .comparemode = vbTextCompare
    For Each v In a
        If Not IsEmpty(v) And Not .exists(v) Then
            .Add v, Nothing
        End If
    Next: z = .keys
End With
With Me.ComboBox1
    .List = Application.Transpose(z)
End With
End Sub

HTH
 
Upvote 0

Forum statistics

Threads
1,191,538
Messages
5,987,172
Members
440,083
Latest member
Bluepanther

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
Top