18.11.2014 Views

Microsoft Office

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using Data Validation 25<br />

FIGURE 25.4<br />

This drop-down list was created using data validation.<br />

TIP<br />

If you specify a range for a list, the range must be on the same sheet. If your list is in a range<br />

on a different worksheet, you can provide a name for the range and then use the name as your<br />

list source (preceded by an equal sign). For example, if the list is on a different sheet in a range named<br />

MyList, enter the following:<br />

=MyList<br />

Using Formulas for Data Validation Rules<br />

For simple data validation, the data validation feature is quite straightforward and easy to use. But the real<br />

power of this feature becomes apparent when you use data validation formulas.<br />

The formula that you specify must be a logical formula that returns either True or False.<br />

If the formula evaluates to True, the data is considered valid and remains in the cell. If the<br />

formula evaluates to False, a message box appears that displays the message specified in the Error Alert tab<br />

of the Data Validation dialog box.<br />

NOTE<br />

You can specify a formula in the Data Validation dialog box by selecting the Custom option in the Allow<br />

drop-down list of the Settings tab. You can enter the formula directly into the Formula control, or you can<br />

enter a reference to a cell that contains a formula. The Formula control appears in the Setting tab of the<br />

Data Validation dialog box when the Custom option is selected.<br />

Understanding Cell References<br />

If the formula that you enter into the Data Validation dialog box contains a cell reference, that reference is<br />

considered a relative reference, based on the upper-left cell in the selected range.<br />

The following example clarifies this concept. Suppose that you want to allow only an odd number to be<br />

entered into the range B2:B10. None of Excel’s Data Validation rules can limit entry to odd numbers, so a<br />

formula is required.<br />

485

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!