I have one sheet containing the table name customer_id and Project_id.For each customer id various projects are displayed.when i try to create data validation by selecting all those it is not coming.for ex. Customer_id Project_id 1 1.1 1 1.2 2 2.2 2 2.3 and like that.please tell me some solution.
-
Create a list of unique customer ID's, then use the result of that list to get the projects that match. Show some example data and what you have tried. – Solar Mike Jun 13 '17 at 06:30
-
And with a bit of research on this site you can find :https://stackoverflow.com/questions/19730067/excel-how-to-create-dynamic-data-validation-list-based-on-data-table?rq=1 , which does almost exactly what you ask... – Solar Mike Jun 13 '17 at 06:37
2 Answers
This really depends on what you want exactly, but since your question is not that elaborate, I guess you mean this?
You can create a data validator from data in your worksheet in the following way:
- Select the sheet you want the validator to be on
- In the ribbon, click the data tab, and then Data validation
- Select 'Allow List'
- in the Source bar, select the cells with the allowed values
Another way, is to create a data validator using a vba or vb.net macro. In your macro say:
Dim range as Excel.Range = listSheet.Range("A1")
range.Validation.Add(Excel.xlDVType.xlValidateList, Excel.xlDVAlertStyle.xlValidAlertInformation, Excel.xlFormatConditionOperator.xlEqual, "Option1; Option2")

- 864
- 14
- 26
I guess what you want are two dropdown lists, the second depending on the value selected in the first one? (please elaborate your questions some more). To do that, I suppose there are other ways but this is what I usually do:
Take into account that I always use names to refer to ranges instead of references, to improve readness. If you have doubts to do it, read Use names in Excel formuas
- Create a table or range somewhere in your book with one column with the master values.
- I have named the range with the values
master_list
- I have named the range with the values
- Create a table or range somewhere in your book with two columns. The first column contains the master/look-up value and the second the dependent values.
- I have named the list of look-up values (this is, the values in the first column) as
dependent_list
- I have named
heading
to the cell above thedependent_list
(for example, if the dependency table starts in A2, theheading
is A1
- I have named the list of look-up values (this is, the values in the first column) as
- Order the lists
- The
master_list
is ordered as you wish values appear in the dropdown list. - The
dependent_list
must be ordered by the values in the first column (master values). It doesn't matter if the order is the same in themaster_list
and thedependent_list
, but identical values in the master column of thedependent_list
must be together. - The order in the second column of the
dependent_list
will determine the order in the dependent dropdown list.
- The
- Optionally you can define a message to display in the
dependent_list
when there is no master value selected. I have named itmsg_error
. - Click on the cell where you want the master dropdown, ant go to the Data Validation menu, where you select:
- Allow: List
- Source: Add the formula
=INDIRECT("master_list")
- I have named the cell where the master dropdown list as
key_value
- Click on the cell where you want the dependent dropdown, and then go to the Data Validation menu, where you select:
- Allow: List
- Source: Add the formula
=IF(key_value="";msg_error;OFFSET(heading;MATCH(key_value;dependent_list;0);1;COUNTIF(dependent_list;key_value);1))
Note that Excel functions are language dependent of the language and I have translated them to English, so maybe there are mistakes.

- 29
- 4
-
ok sorry for the incomplete question! i have mastersheet which contains account number and project related to account number.i have created separate dropdown and its working but my task is to create one dependent dropdown list of project which is dependent on account number and when i try to do i am failing.so i need to extract data from that sheet to new sheet and implement this task – vish Jun 13 '17 at 10:34
-
Then I think you should be able to do that with the tips I wrote. I have the data in one auxiliary sheet (key master table, key-value dependent table and default message -which can be empty-) and the dropdowns in the main sheet. – Fran Reneses Jun 13 '17 at 13:14