Excel.Tips.Net Welcome toExcel.Tips.Net

Helpful Links

Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment

Tips.Net Store

ExcelTips FAQ
ExcelTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

Newest Tips

Recording a Macro

Adding a Little Animation to Your Life

Converting a Range of URLs to Hyperlinks

Making the Formula Bar Persistent

Engineering Calculations

Digital Signatures for Macros

Fixing the Decimal Point

 

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.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3195) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007

Make Home Buying Less Stressful! Why make home buying harder than it needs to be? Put your mind at ease—discover all the questions you need to ask to make the best buying decision.
 
Check out Buying a Home Checklist today!