bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Editing > Contingent Validation Lists

Contingent Validation Lists

Summary: Data validation can be used to create lists of choices for entry into a particular cell. Using the techniques in this tip you can create multiple lists in which the second list is contingent on the choice in the first list. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

The data validation capabilities in Excel are quite handy, particularly if your worksheets will be used by others. When developing a worksheet, you might wonder if there is a way to make the choices in one cell contingent on what is selected in a different cell. For instance, you may set up the worksheet so that cell A1 uses data validation to select a product from a list of products. You would then like the validation rule in cell B1 to present different validation lists based on the product select in A1.

The easiest way to accomplish this task is in this manner:

  1. Beginning at cell F1, set up a data table. This table will contain your product “matrix.” In the first cell of each column, indicate a category name, such as Computers, Televisions, and Recorders.
  2. Under each heading in the product matrix, list the various products in the category.
  3. Select the headings from the data table, such as F1:H1.
  4. Choose Insert | Name | Define. Excel displays the Define Name dialog box. (Click here to see a related figure.) (To display the equivalent dialog box in Excel 2007, display the Formulas tab of the ribbon and then click on Define Name in the Defined Names group. Excel displays the New Name dialog box.)
  5. In the Name box, enter a descriptive name, such as Choices.
  6. Click OK to add the name and close the dialog box.
  7. Select the actual products in column F. Don’t select the heading (F1); just select the products under the heading.
  8. Again display the Define Name dialog box, as described in step 4.
  9. In the Name box, enter the same name you used as a heading in that column, such as Computers.
  10. Click OK to add the name and close the dialog box.
  11. Repeat steps 7 through 10 for the other product columns. In each case, make sure you define the name as the same name used in the column header.
  12. Select cell A1 and choose Validation from the Data menu. Excel displays the Data Validation dialog box. (To display the dialog box in Excel 2007, display the Data tab of the ribbon and then, in the Data Tools group, click the Data Validation tool.)
  13. Using the Allow drop-down list, choose List.
  14. In the Source box, enter an equal sign followed by the name you defined in step 5 (such as =Choices). (Click here to see a related figure.)
  15. Click OK.
  16. Select cell B1 and again display the Data Validation dialog box as described in step 12.
  17. Using the Allow drop-down list, choose List.
  18. In the Source box, enter the following: =INDIRECT(A1).
  19. Click OK. Excel displays a dialog box asking if you really want to use the rule. (This is because the referenced cell, A1, currently resolves to an error condition.)
  20. Click Yes.

That’s it. Now, whatever is chosen in cell A1 dictates which list is presented in cell B1.

Tip #3195 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


PivotTables Got You Perplexed? PivotTables for the Faint of Heart shows how you can start using Excel's PivotTable tool right away to spin your data into gold! You discover how easy it really is to crunch the numbers you need to crunch. Uncover the power of creating PivotTables, editing them, formatting them, customizing them, and much more.
 
Check out PivotTables for the Faint of Heart today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Bugs and Pests Tips
ExcelTips
Family Tips
Health Tips
Home Tips
Organizing Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)