Search This Blog

Thursday 25 March 2010

Validation for drop downs

Create separate lists. Highlight each list in turn and choose Insert | Name | Define from the menu, using the category name as the name for this range.

Let's suppose the user will choose a category in cell E2 and a product in cell F2. Click in E2 and select Validation from the Data menu. Select List from the drop-down titled Allow and enter =Categories in the Source box, then click OK. This establishes a simple list-based validation rule the user can enter only values found in the Categories range, and those values appear in a drop-down list.
Now click in cell F2, select Data | Validation, and choose List from the Allow drop-down, as before. This time in the Source box enter =INDIRECT(E2). This selects the range named by the contents of cell E2. If E2 contains "Cabinets," the list of cabinets will be presented in F2, and so on. When the user selects a different category in E2, the list in F2 changes. It is still possible to get a mismatch if the user chooses a product and then changes the category.