Dropdown list with sorting in another column

Vincent88

Active Member
Joined
Mar 5, 2021
Messages
382
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
Hi, Currently I am using formules to make a dropdown list with sorting. How to create VBA code of a dropdown list with sorting function.


AgentProposal_Roster0728_1004.xlsm
LMNOP
1AgentSortedAgentSearchFrequencyFinalList
2Cat GBady B11Bady B
3Mary KCat G12Cat G
4John GJack S13Jack S
5Ken CJeffrey L14Jeffrey L
6Zita VJohn G15John G
7Larry QKen C16Ken C
8Mandy HLarry Q17Larry Q
9Warus OMandy H18Mandy H
10Jack SMary K19Mary K
11Nacy LNacy L110Nacy L
12Peter BPeter B111Peter B
13Bady BQueen M112Queen M
14Jeffrey LRobert Y113Robert Y
15Queen MSussie M114Sussie M
16Robert YWarus O115Warus O
17Sussie MZita V116Zita V
Data
Cell Formulas
RangeFormula
M2:M17M2=INDEX([Agent],MATCH(ROWS($L$2:L2),COUNTIF([Agent],"<="&[Agent]),0))
N2:N17N2=IF(ISNUMBER(SEARCH(CELL("contents"),[SortedAgent])),1,"")
O2:O17O2=IF(N2=1,COUNTIF($N$2:N2,1),"")
P2:P17P2=IFERROR(INDEX([SortedAgent],MATCH(ROWS($P$2:P2),[Frequency],0)),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Named Ranges
NameRefers ToCells
'202108'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202109'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202110'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202111'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202112'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202201'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202202'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
'202203'!HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
HelpAgent=OFFSET(Data!$P$2,,,COUNTIF(Table1[FinalList],"?*"))P2:P17
Cells with Data Validation
CellAllowCriteria
O2:O17Any value
L2:L17Custom=COUNTIF($L:$L,L2)=1
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How to create VBA code of a dropdown list with sorting function.
If you're interested, here's an example of a searchable drop-down with unique, sorted & non blank list.
OR

use a free add-in called "Search deList"
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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