adapt drop down list after selection is made

robertvdb

Active Member
Joined
Jan 10, 2021
Messages
334
Office Version
  1. 2016
Platform
  1. Windows
I have the following issue:

in col A there is a list of cities.
in cell B2, I have a drop down list which contains the values from col A.
in cell C2, I have the value I have selected from the drop down list. In C3, further value after further selection, and so on.

Now, for future selections, I want the drop down list to EXCLUDE the value which is already in C2, C3 and further down.

Any way how to achieve this ? Without VBA ?
 

Attachments

  • cities.png
    cities.png
    25.3 KB · Views: 13

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Not really sure if this is what you want. But, this is building drop downs based upon prior lists. I have 365, so I don't get blanks at the bottoms of my drop down list. But, they should only be at the bottom of yours (actually I get one blank).

Book1
ABCDEFGHIJKLMNOPQR
1Drop1Drop2Drop3Drop4Drop5Drop6Drop7Drop8Drop1Drop2Drop3Drop4Drop5Drop6Drop7Drop8
2City2City1City11City5City6City3City9City7City1City1City3City3City3City3City4City4
3City2City3City4City4City4City4City7City7
4City3City4City5City5City6City7City8City8
5City4City5City6City6City7City8City9City10
6City5City6City7City7City8City9City10 
7City6City7City8City8City9City10  
8City7City8City9City9City10   
9City8City9City10City10    
10City9City10City11     
11City10City11      
12City11       
13
14
Sheet4
Cell Formulas
RangeFormula
K2:Q12K2=IF(A$2="","",IF((ROW()-1)>(ROWS(J$2:J$12)-1)-(COLUMNS($B$2:$B2)-1),"",INDEX(J$2:J$12,SMALL(IFERROR((ROW(J$2:J$12)-1)/((J$2:J$12<>A$2)),2^1000),ROW()-1))))
Named Ranges
NameRefers ToCells
Drop1=Sheet4!$J$2:$J$12K2:K12
Drop2=Sheet4!$K$2:$K$12L2:L12
Drop3=Sheet4!$L$2:$L$12M2:M12
Drop4=Sheet4!$M$2:$M$12N2:N12
Drop5=Sheet4!$N$2:$N$12O2:O12
Drop6=Sheet4!$O$2:$O$12P2:P12
Drop7=Sheet4!$P$2:$P$12Q2:Q12
Cells with Data Validation
CellAllowCriteria
A2List=Drop1
B2List=Drop2
C2List=Drop3
D2List=Drop4
E2List=Drop5
F2List=Drop6
G2List=Drop7
H2List=Drop8
 
Upvote 0
See if this is what you mean. Using a helper column (I have used column F) which could be hidden.
Formula in F2 is copied down to whatever the last row of data is in column A (row 20 in your example)
Use the Data validation shown in the mini sheet for cell B2

24 03 24.xlsm
ABCDEF
1CitiesSelect CitySelectedF2:F9
2City1City2City1
3City2City3City5
4City3City4City6
5City4City7City8
6City5City9City10
7City6City12City11
8City7City13City16
9City8City14City19
10City9City15 
11City10City17 
12City11City18 
13City12 
14City13 
15City14 
16City15 
17City16 
18City17 
19City18 
20City19 
21
DV
Cell Formulas
RangeFormula
F1F1=IF(F2="","",ADDRESS(ROW(F2),COLUMN(),4)&":"&ADDRESS(ROW(F2)+COUNTIF(F2:F20,"?*")-1,COLUMN(),4))
F2:F20F2=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$20)/ISNA(MATCH(A$2:A$20,C:C,0)),ROWS(F$2:F2))),"")
Cells with Data Validation
CellAllowCriteria
B2List=INDIRECT(F1)


With the previous selections shown in col C, this is what the DV drop-down now looks like

1711252176698.png
 
Upvote 0
Thanks Peter, this seems the right way to work in... Only one question: how do I populate the cells in column C, once I've selected a value in B2 ?
 
Upvote 0
: how do I populate the cells in column C, once I've selected a value in B2 ?
You would have to do that manually or with vba code.
Alternatively, why not have the data validation applied to the cells in column C and the user selects the cities directly in that column?

24 03 24.xlsm
ABCDEF
1CitiesSelectedF2:F12
2City1City5City2
3City2City11City3
4City3City19City4
5City4City10City7
6City5City6City9
7City6City16City12
8City7City1City13
9City8City8City14
10City9City15
11City10City17
12City11City18
13City12 
14City13 
15City14 
16City15 
17City16 
18City17 
19City18 
20City19 
21
DV (2)
Cell Formulas
RangeFormula
F1F1=IF(F2="","",ADDRESS(ROW(F2),COLUMN(),4)&":"&ADDRESS(ROW(F2)+COUNTIF(F2:F20,"?*")-1,COLUMN(),4))
F2:F20F2=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$20)/ISNA(MATCH(A$2:A$20,C:C,0)),ROWS(F$2:F2))),"")
Cells with Data Validation
CellAllowCriteria
C2:C20List=INDIRECT(F$1)


1711273953136.png
 
Upvote 0
Solution
Not really sure if this is what you want. But, this is building drop downs based upon prior lists. I have 365, so I don't get blanks at the bottoms of my drop down list. But, they should only be at the bottom of yours (actually I get one blank).

Book1
ABCDEFGHIJKLMNOPQR
1Drop1Drop2Drop3Drop4Drop5Drop6Drop7Drop8Drop1Drop2Drop3Drop4Drop5Drop6Drop7Drop8
2City2City1City11City5City6City3City9City7City1City1City3City3City3City3City4City4
3City2City3City4City4City4City4City7City7
4City3City4City5City5City6City7City8City8
5City4City5City6City6City7City8City9City10
6City5City6City7City7City8City9City10 
7City6City7City8City8City9City10  
8City7City8City9City9City10   
9City8City9City10City10    
10City9City10City11     
11City10City11      
12City11       
13
14
Sheet4
Cell Formulas
RangeFormula
K2:Q12K2=IF(A$2="","",IF((ROW()-1)>(ROWS(J$2:J$12)-1)-(COLUMNS($B$2:$B2)-1),"",INDEX(J$2:J$12,SMALL(IFERROR((ROW(J$2:J$12)-1)/((J$2:J$12<>A$2)),2^1000),ROW()-1))))
Named Ranges
NameRefers ToCells
Drop1=Sheet4!$J$2:$J$12K2:K12
Drop2=Sheet4!$K$2:$K$12L2:L12
Drop3=Sheet4!$L$2:$L$12M2:M12
Drop4=Sheet4!$M$2:$M$12N2:N12
Drop5=Sheet4!$N$2:$N$12O2:O12
Drop6=Sheet4!$O$2:$O$12P2:P12
Drop7=Sheet4!$P$2:$P$12Q2:Q12
Cells with Data Validation
CellAllowCriteria
A2List=Drop1
B2List=Drop2
C2List=Drop3
D2List=Drop4
E2List=Drop5
F2List=Drop6
G2List=Drop7
H2List=Drop8
Thanks awoohaw. However, your suggested solution is somewhat complicated, therefore I prefer Peter's solution, see below.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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