Dependent List in Excel - excel

My question is , in excel when we create a dependent dropdown we write the formula for the other dropdown dependent on the first one. For example if USA is selected in first col the matching City of USA will be pulled and then can be populated in a data validation list.
I know how to write formula to get the items matching criteria. My problem is what if we have multiple dropdowns .
For example we have 100 rows with column A for selecting Countries and then next to each of these we have dropdown for selecting City.
Do I need to write 100 formulas for these dependent dropdowns or there is another way around to achieve this?

Consider the following,
        
The data validation lists in A2:A10 are based on a List with a Source: of,
=$AA$2:$AA$5
The data validation lists in B2:B10 are based on a List with a Source: of,
=INDEX($AB$2:$AE$6, 0, MATCH($A2, $AB$1:$AE$1, 0))
sample workbook

Related

Excel Data Validation (List) with IF Contains text

I am trying to do a data validation list where the drop down only contains text like "US" or "EU" to isolate the PO numbers. The table column I am pulling from can have things like "US12345" or "EU76543" or "ID10987". I need the list to only show the items that have that US in them.
I tried:
=IF(INDIRECT(Table[PO_Number])="US*",INDIRECT(Table[PO_Number]),"")
This gives a Value Error.
Is what I am trying to do possible? If so, how?
You'll need to create the desired filtered list somewhere within the workbook, as dynamic lists cannot be entered directly within Data Validation.
For example, assuming you have Office 365, this formula in cell D1:
=FILTER(Table[PO_Number],LEFT(Table[PO_Number],2)="US")
will spill all matching entries.
(Amend the condition - here checking if the initial two letters of the PO Number are "US" - as required.)
For the Data Validation, you can then use the List option and set the Source to:
=$D$1#
Include the sheet name in the above expression if the cells being validated are not in the same sheet as the FILTER formula.

Excel Structed Reference to filter Table and produce List

I want to filter a table in excel and return a different column to create a list for data validation.
My table contains a list of names and one of the columns is a Yes or No for being an admin.
I want to create a data validation list on another sheet and use the filter table to just show those names that have a Yes in their associated row in the table.
I recorded a macro to filter the table to show just the rows I need and now want those names to appear in the list.
ActiveSheet.ListObjects("Staff").Range.AutoFilter Field:=8, Criteria1:="<>"
Is this possible?
I had tried using the =FILTER() formula but it's not available in my version of Excel.
I'd prefer to do it with a formula in the validation settings rather than VBA.
This is something of a faff but I think it works, though by no means the best way of doing it.
Table of data on the left.
The "Yes" names are listed in D1 and down, the formula is an array (use Ctrl, Shift and Enter to confirm). I'm sure someone cleverer than me can shorten this.
=IF(ROWS(D$1:D1)<=COUNTIF(Table1[Admin],"Yes"),INDEX(Table1[Name],SMALL(IF(Table1[Admin]="Yes",ROW(Table1[Name])-ROW($A$2)+1),ROWS(D$1:D1)),1),"")
E1 is just the total of the names shown in D (another array formula):
=SUM(IF(LEN(D:D)>0,1,0))
The DV is in G1 and the formula there is
=OFFSET(D1,0,0,E1,1)
If you change e.g. Sarah to Yes, her name will appear in D and will be added to the DV list.
Once you've applied your filter to column 8, you can select the range that remains visible in a different column using:
ActiveSheet.ListObjects("Staff").Range.Columns(8).SpecialCells(xlCellTypeVisible).Offset(0, -2)
This would return a range consisting of column 6 (8-2) of your table. Adjust to suit your needs.
You could then cycle through that range one cell at a time and populate a new range from it, accordingly.

Excel Dependent Lists with duplicates

My problem is the following:
I have multiple columns i want to make dependent lists of, but i have duplicates in the first 3 columns. I am able to make them dependent, but all the duplicates show up in the dropdown.
For Example:
You can see, the First column has duplicates and so does the second.
This is what i have tried.
Made the Product Category list as a List under Data validation using the uniques only.
Used the Offset, match formula to make the Sub-Product ID as a dependent list on what is selected in the cell before it for Product category.
When i do No. 2, say i chose A1 in the Product category, i end up getting 100,100 in the drop-down. I only want one iteration of 100 to be in the dependent dropdown.
Formula Used: =OFFSET(Second!E5,MATCH(C3,Second!$D$6:$D$282,0),0,COUNTIF(Second!$D$6:$D$282,C3))
Please help.

Excel Dynamic Drop Down List

I have two tables that get dynamically created from a database query; the first table is the source of the drop-down list, and the second is the table that I will apply the drop-down list via data validation. First table:
and the second table:
What I need, ideally through just Excel formulas, is an intelligently designed drop-down that shows only the dimension values associated to the dimension in question.
So in cells B3:B10, the drop-downs would show a,b,c. In cells C3:C10, the drop-downs would show 1,2,3. In cells D3:D10, the drop-downs would show x,y,z. Etc, etc.
I need this to be dynamic in the sense that a week from now my DB query may return a fourth dimension that would need to follow the same approach.
Not sure if this is even possible without writing some VBA, but I figure I'd see if anybody has any creative ideas. Cheers!
You have to use Name Manager and =INDIRECT() formula to achieve that.
First download the sample file.
Sample File
See this tip (By me). It will help you to see screenshots step by step. Link is here
Now in-case of your data you have to use some formula to filter data automatically when new data come. So that new data can organize for dynamic combo boxes. I can also do that for you if you are not able to do that. Then share your sample workbook with me.
It is very possible, but not simple. There are a several ways to implement this, depending on your requirements, how dynamic it needs to be, and the expected structure of the data (as I mentioned in a comment).
I will give one possible solution, that is mostly dynamic, and is the simplest to explain. You can use a similar logic to make it all dynamic.
This solution will retrieve the data from table #1 according to the dimension name, assuming it is not sorted, and return the values in the order they are given in the table.
For some of the ranges I create names for simplicity, and some are mandatory. In order to follow the formulas logic you need the named ranges I use.
Create named ranges for table #1: (Either by using the Name Box or using the Name Manager Ctrl+F3):
For the data in the column Dimension: DimName =B3:B11
For the column Dimenstion Value: DimValue =C3:C11
Create dimension values lists in a new sheet:
Put the dimension name in B2 ="Customer". (The available dimension names can be created dynamically as well, but I'm skipping this part for simplisity).
B3 (array formula - Ctrl+Shift+Enter) =IFERROR(INDEX(DimVal,SMALL(IF(DimName=B$2,ROW(DimName)-ROW(INDEX(DimName,1))+1),ROWS(B$3:B3)),1),""). This formula returns the k-th value for the "Customer" dimension.
Copy B3 down to as many rows you think you'll need. Let's say B4:B10, so B3:B10 will have the array formula. The first cells will have the available values and the remaining cells will be empty because of the IFERROR function.
In B1 we will count the available values using the formula =SUMPRODUCT(--(B3:B10<>"").
Do the same for "Product" and "Geography" in columns C and D.
Create dynamic named ranges for the lists: (using the Name Manager Ctrl+F3)
For the lists' data DimLists =B3:D10.
For the lists' headers DimListHeaders =B2:D2.
For the lists' counts DimListCounts =B1:D1.
*These names are mandatory for the data validation to work in another sheet.
Set table #2 data validation list sources:
Select B3:B10 in table #2.
Go to Data > Data Validation, and select Allow: List.
Put the following formula in the source: =OFFSET(INDEX(DimLists,,MATCH(B$2,DimListHeaders,0)),,,INDEX(DimListCount,,MATCH(B$2,DimListHeaders,0))). This formula finds the correct list in DimLists according to the column header in table #2, and also sets the returned range height according to the list count.
Hope this helps.

Excel formulas and conditional lookups based on multiple criteria and sheets

I have 2 sheets:
sheet_a is a styled print-ready layout for a single data record
sheet_b is a bulk data table which is continually growing. Each row corresponds to a single complete record
Currently I am using a VLOOKUP to collect the data from sheet_b and put it in the respective cells in sheet_a. I have a drop down list on sheet_a which allows me to select a single record at a time to view.
Now I want to introduce a second drop down list to sheet_a where I want to select 1 of 4 specific conditions relating to the value of a cell in a specific column of each record on sheet_b.
I only want the entries that meet this condition in sheet_b to be made available in the range of records I can view on sheet_a.
Can anyone help?
As I understand it, you are looking for a way to filter the list that is used in the drop-down on Sheet_A.
add a column to the source data and calculate or mark manually which of the four conditions the record belongs to.
on Sheet_a add a drop-down field where the user can select from the four conditions. Name this cell "criterion"
in the source data table, add a column with a formula that returns the row number if the current row matches the selected criterion. Something like this copied down
=IF(B2=criterion,ROW(),"")
create another helper column that contains only the items that match the criterion using a formula like this and copied down
=INDEX(Data,SMALL($E$2:$E$18,ROW(A1)))
use a dynamic range name called "FilteredList" that contains only the values of the result list, not the errors. The formula for "FilteredList" is
=Sheet1!$F$2:INDEX(Sheet1!$F:$F,MATCH("zzzzz",Sheet1!$F:$F,1))
change the drop-down that is currently used to select a record to source its values from =FilteredList

Resources