Exclude certain values from dropdown list

Polanskiman

Board Regular
Joined
Nov 29, 2011
Messages
119
Office Version
  1. 365
  2. 2016
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
  2. MacOS
  3. Mobile
Hello,

I am working a rather complex worksheet. I'll try to make my question simple. Please let me know if you need further details.

I have a table with multiple rows/columns containing data. I need to create several dropdown lists from that table and from the same range but with each dropdown list excluding certain values according to certain criteria.

I cannot use VBA for this project.

Is that possible?
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Small note. I am aware I could replicate the table as many times as necessary by excluding the values I don't want in each dropdown list but I want to avoid that.
 
Upvote 0
Having no answer I posted my question here as well:
 
Upvote 0
Since you have Excel 365, try this. I have just done one but you should be able to replicate for the others. Helper column (P) can be hidden.
Formula needs to be entered into cell P4 only. The other results will automatically 'spill' to the other rows.

BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers.

mockup.xlsx
BCOP
1
2
3ProductsTypefert + rem
4ADA Brighy 'N'fertADA Brighy 'N'
5ADA DosingfertADA Dosing
6ADA E.I. MixfertADA E.I. Mix
7APFUK TracetrClives E.I. Target
8Clives E.I. TargetfertEI Dosing Full
9CSM+B TracetrEI Dosing Low
10EI Dosing FullfertEI Dosing Mid
11EI Dosing LowfertEI Modified
12EI Dosing MidfertPMDD
13EI ModifiedfertPMDD+PO4
14GLA EDTA MicromixtrProflora Ferropol
15PMDDfertSeachem Flourish
16PMDD+PO4fertTNC Complete
17Proflora FerropolfertTPN+ Fertiliser
18Rexolin APNtrTropica Premium Nutrition
19Seachem FlourishfertTropica Specialised Nutrition
20Solufeed TECtrSeachem Equilibrium (remineraliser)
21TNC CompletefertTNC GH Boost (remineraliser)
22TPN+ Fertiliserfert
23Tropica Premium Nutritionfert
24Tropica Specialised Nutritionfert
25Seachem Equilibrium (remineraliser)rem
26TNC GH Boost (remineraliser)rem
27
28This list should only contain values from B colum which match 'fert' and 'rem' from C column:
29
RCFerts
Cell Formulas
RangeFormula
P4:P21P4=FILTER(RCFerts_Table[Products],(RCFerts_Table[Type]="fert")+(RCFerts_Table[Type]="rem"))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B29List=P4#


1595068550563.png
 
Upvote 0
Thank you Peter. Isn't that more less what I had done in the helper column (A column)? Your formula is however way simpler and I like that! Would it work with earlier versions of Excel? The file is intended to be distributed publicly so it should support older versions of Excel.

Also any specific reason why the helper column should be at the end of the table and not at the beginning?

Finally, the issue that remains is that if for some reason the column is sorted then it screws up the results of my formulas who are picking data in other sheets. The sorting causes the index/match to pick data from the wrong rows :(

For XL2BB yes I know about it. Next time I will use it.

Thank you again.
 
Upvote 0
Actually I think I figured a way to avoid the mixing up when sorting. Instead of using the helper column in the Match statement, simply use the actual column (column B) and use the selected value from the dropdown list as a mean to index/match. I was previously using the helper column in my formula. :unsure:
 
Upvote 0
Isn't that more less what I had done in the helper column (A column)?
Yes, it is, though only for "fert". I hadn't looked at column A as your question appeared to be about columns B & C. :)


Would it work with earlier versions of Excel?
No. You will need to revert to something more like you had done. I'll get back to that.


Also any specific reason why the helper column should be at the end of the table and not at the beginning?
Left or right is not an issue. To me though, I don't think I would be compiling the drop-down lists in the table itself since in virtually all cases the drop-down lists will be shorter than the full table. How did you intend to use that reduced length list in column A in your Data Validation? Or were you just going to leave all those blank rows in your DV drop-down list at the bottom?


I would consider doing the list outside the table along these lines.

Polanskiman mockup.xlsx
BCOP
1
2fert + rem
3ProductsType$P$4:$P$21
4ADA Brighy 'N'fertADA Brighy 'N'
5ADA DosingfertADA Dosing
6ADA E.I. MixfertADA E.I. Mix
7APFUK TracetrClives E.I. Target
8Clives E.I. TargetfertEI Dosing Full
9CSM+B TracetrEI Dosing Low
10EI Dosing FullfertEI Dosing Mid
11EI Dosing LowfertEI Modified
12EI Dosing MidfertPMDD
13EI ModifiedfertPMDD+PO4
14GLA EDTA MicromixtrProflora Ferropol
15PMDDfertSeachem Flourish
16PMDD+PO4fertTNC Complete
17Proflora FerropolfertTPN+ Fertiliser
18Rexolin APNtrTropica Premium Nutrition
19Seachem FlourishfertTropica Specialised Nutrition
20Solufeed TECtrSeachem Equilibrium (remineraliser)
21TNC CompletefertTNC GH Boost (remineraliser)
22TPN+ Fertiliserfert 
23Tropica Premium Nutritionfert 
24Tropica Specialised Nutritionfert 
25Seachem Equilibrium (remineraliser)rem 
26TNC GH Boost (remineraliser)rem 
27
28This list should only contain values from B colum which match 'fert' and 'rem' from C column:
29
RCFerts
Cell Formulas
RangeFormula
P3P3=CELL("address",P4)&":"&CELL("address",OFFSET(P4,COUNTIF(P4:P26,"?*")-1,,1))
P4:P26P4=IFERROR(INDEX(RCFerts_Table[Products],AGGREGATE(15,6,(ROW(RCFerts_Table[Products])-ROW(RCFerts_Table[#Headers]))/((RCFerts_Table[Type]="fert")+(RCFerts_Table[Type]="rem")),ROWS(P$4:P4))),"")
Cells with Data Validation
CellAllowCriteria
B29List=INDIRECT(P3)
 
Upvote 0
Left or right is not an issue. To me though, I don't think I would be compiling the drop-down lists in the table itself since in virtually all cases the drop-down lists will be shorter than the full table. How did you intend to use that reduced length list in column A in your Data Validation? Or were you just going to leave all those blank rows in your DV drop-down list at the bottom?
I would consider doing the list outside the table along these lines.
Hi Peter. Highly appreciate it. Ok for the placement of the helper column.

The intention was not to leave the blanks. The secondary issues was in fact not directly the DV dropdown list but the formulas using the DV dropdown list range as a means to do an index/match and that's where the problem was coming from. This is a collaborative work excel sheet so I hadn't noticed that until yesterday after your answer.

Thank you for the updated version of the helper column formula. I had been banging my head on how to add multiple criteria to the formula. I was trying to do it with an AND statement but I failed miserably.

Few questions:

  • Can you elaborate on the use of the INDIRECT statement for DV formula line?
  • Would this new arrangement allow inserting rows in the table and the DV dropdown list would dynamically update?
  • Prior my question here, I had integrated the helper column in the table in column A. I am on Excel for MAC but I don't a way to modify the range of the table other moving the column beyond the table to the right. What would be the best way to go?

Thank you.
 
Upvote 0
Prior my question here, I had integrated the helper column in the table in column A. I am on Excel for MAC but I don't a way to modify the range of the table other moving the column beyond the table to the right. What would be the best way to go?
Starting with this one first. I do not use a Mac so I can't be any help specifically with that. The grammar of this point lost me a little but I think you are saying that you want the DV list in the table? If so, that is fine. Would you hide this column? If so, that would also hide what I have in A29 as the users do not need to see that. So I have moved the list formula to column A. You might consider simplifying the table heading in col A to something like 'ProductHelp' as that would make the A29 formula somewhat simpler.

Polanskiman mockup.xlsx
AB
1
2
3Products (Helper Column)Products
4ADA Brighy 'N'ADA Brighy 'N'
5ADA DosingADA Dosing
6ADA E.I. MixADA E.I. Mix
7Clives E.I. TargetAPFUK Trace
8EI Dosing FullClives E.I. Target
9EI Dosing LowCSM+B Trace
10EI Dosing MidEI Dosing Full
11EI ModifiedEI Dosing Low
12PMDDEI Dosing Mid
13PMDD+PO4EI Modified
14Proflora FerropolGLA EDTA Micromix
15Seachem FlourishPMDD
16TNC CompletePMDD+PO4
17TPN+ FertiliserProflora Ferropol
18Tropica Premium NutritionRexolin APN
19Tropica Specialised NutritionSeachem Flourish
20Seachem Equilibrium (remineraliser)Solufeed TEC
21TNC GH Boost (remineraliser)TNC Complete
22 TPN+ Fertiliser
23 Tropica Premium Nutrition
24 Tropica Specialised Nutrition
25 Seachem Equilibrium (remineraliser)
26 TNC GH Boost (remineraliser)
27
28This list should only contain values from B colum which match 'fert' and 'rem' from C column:
29$A$4:$A$21
RCFerts
Cell Formulas
RangeFormula
A4:A26A4=IFERROR(INDEX([Products],AGGREGATE(15,6,(ROW([Products])-ROW(RCFerts_Table[#Headers]))/(([Type]="fert")+([Type]="rem")),ROWS(A$4:A4))),"")
A29A29=CELL("address",INDEX(RCFerts_Table[Products (Helper Column)],1))&":"&CELL("address",OFFSET(INDEX(RCFerts_Table[Products (Helper Column)],1),COUNTIF(RCFerts_Table[Products (Helper Column)],"?*")-1,,1))
Cells with Data Validation
CellAllowCriteria
B29List=INDIRECT(A29)



Can you elaborate on the use of the INDIRECT statement for DV formula line?
We don't know how many rows there will be in the DV list so we cannot input a range directly into the Data Validation. You will see that A29 holds the address of the actual DV range and it will automatically adapt if the list grows or shrinks. The INDIRECT(A29) tells the DV to go to A29 & use that text as the range reference for the DV.


Would this new arrangement allow inserting rows in the table and the DV dropdown list would dynamically update?
Yes.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

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