Search Contextures Sites
Excel Data Validation -- Hide Previously Used Items in Dropdown
Thanks to Excel MVP, Peo Sjoblom, who contributed the original formula for this technique, and to Daniel.M, who suggested the enhanced formulas.
Set up the Main Table
Create the List of Items
Create the Excel Data Validation List
Apply the Excel Data Validation
Test the Excel Data Validation
Dependent Data Validation
Multiple Column Data Validation
To download a zipped sample file, click here:
Excel Data Validation -- Hidden Items -- Sample
You can limit the choices in an Excel Data Validation list, hiding items that have been previously selected. For example, if you are assigning employees to a shift, you want to avoid assigning the same employee twice.
In the dropdown list, the names that have been used are removed.
Start by setting up the table in which you want to use the Excel Data Validation. In this example, the worksheet is named 'Schedule' and the range A1:C7 is being used.
Column B will have Data Validation applied.
Create a list which contains the items you want to see in the Excel data validation dropdown list. Here, the employee names have been entered in cells A1:A6, on a sheet named 'Employees'
A) Enter a formula to calculate if a name has been used.
1. On the Employees sheet, in cell B1, enter the following formula:
2. Copy the formula down to cell B6.
This formula counts the occurrences of "Bert" in cells B2:B7 on the Schedule worksheet. If the count is greater than or equal to 1, the cell will appear blank. Otherwise, the row number will be displayed.
B) Create the list of unused names
The next step is to create a multi-cell array formula which will move any blank cells to the end of the list.
- Select cells C1:C6
- Enter the following array formula (the formula is long, and should be all on one line)
3. Press Ctrl+Shift+Enter to enter the array formula in cells C1:C6
Single-Cell Formula Alternative
If you'd prefer a single-cell formula (easier to edit), you could use this formula, also by Daniel.M. He recommends it for small ranges (<=200 cells):
- Select cell C1
- Enter the following formula (the formula is long, and should be all on one line)
- Press Enter
- Copy the formula down to row 6
Name the Excel Data Validation List
1. Choose Insert>Name>Define
2. In the Names in workbook box, type a one-word name for the range, e.g. NameCheck.
3. In the Refers to box, type the following formula (all on one line):
4. Click OK
1. Select the cells in which you want to apply data validation using the Excel data validation list
2. From the Data menu, choose Validation.
3. From the Allow dropdown list, choose List
4. In the Source box, type an equal sign and the list name, for example: =NameCheck
5. Click OK.
The dropdown list in column B shows only the names that haven't been used. Other names have been removed.
To download a zipped sample file, click here: Data Validation -- Hidden Items -- Sample
This technique can be modified, and used with Dependent Data Validation, as in the zipped sample workbook found here: Hide Previously Used - Dependent
To download this example, go to the Excel Sample Spreadsheets page, and in the Data Validation section, look for DV0016 - Assign Employees to Single Task Per Day
Excel Tutorials - Data Validation
Data Validation Basics
Data Validation - Create Dependent Lists
Data Validation - Dependent Dropdowns from a Sorted List
Data Validation - Dependent Lists With INDEX
Hide Previously Used Items in a Dropdown List
Data Validation - Display Messages to the User
Data Validation - Display Input Messages in a Text Box
Data Validation - Use a List from Another Workbook
Data Validation Criteria Examples
Data Validation Custom Criteria Examples
Data Validation Tips
Data Validation Documentation
Data Validation Combo Box
Data Validation Combo Box - Named Ranges
Data Validation Combo Box -- Click
Data Validation - Add New Items
Contextures Inc., Copyright ©2012
All rights reserved.
Last updated: October 15, 2010 11:37 AM