问题
Excel Noob here.
I am trying to create a dropdown list based on a cell value. The data for the dropdown list is in a table called "Data". I want to populate a drop-down box with values based on a column (Status) in the data table. Status Column has 4 values: Open, Closed, Open-Future, Hold. When the Open Status is selected, I would like the dropdown to populate the ticket numbers associated with that status, but I am unable to achieve it.
The drop-down is located in another tab, where the information in the table is presented in a page view format per ticket. Otherwise, when presenting the information, I have to scroll rows and columns when presenting the details of a ticket.
The table structure is as below; Column 1: Ticket No Column 2: Issue Title Column 3: Description Column 4: Status and other columns applicable to the ticket
I tried, conditional drop-down list examples described here but it did not work. My guess is due to the data structure in my table. Unfortunately, I am unable to change the column structure nor use VBA to address the issue and relying on a magic formula.
Hope I explained the issue with relevant details, please let me know if you need further information to derive to a solution. Note: I don't see an easy way to attach the sample document, as it's work computer and restrictions are put around using most of the file-sharing websites. So I have uploaded the screenshot of the spreadsheets refer to attached
Thanks Al Sheik
回答1:
Suppose you have sorted your Data
table by Status, you can insert a helper column as shown below:
The formula in Cell C2
is
=IF(B2=Select_Status,ROW()-1,"")
where Select_Status is the name I gave to the cell where your primary drop down list sits. In my example it is cell G2
.
The logic is to return the row position of the ticket number based on the status you selected.
Next, create a new named range using the following formula. In my example I have named it as FilteredList.
=OFFSET($A$1,MIN(FilteredTN),,COUNTIF(FilteredTN,">0"))
Then you can use this named range in your secondary drop down list:
Here is what you should get:
Let me know if you have any questions. Cheers :)
来源:https://stackoverflow.com/questions/58270978/formula-for-dependent-drop-down-list-from-table-data-in-excel