Microsoft Office Tutorials and References

In Depth Information

=ISODD(B2)

This formula uses the ISODD function, which returns TRUE if its numeric argument is an odd number.

Notice that the formula refers to the active cell, which is cell B2.

5.
On the Error Alert tab, choose Stop for the Style and then type
An odd number is required here
as the Er-

ror Message.

6.
Click OK to close the Data Validation dialog box.

Figure 20-5:
Entering a data validation formula.

Notice that the formula entered contains a reference to the upper-left cell in the selected range. This data valida-

tion formula was applied to a range of cells, so you might expect that each cell would contain the same data val-

idation formula. Because you entered a relative cell reference as the argument for the ISODD function, Excel

adjusts the formula for the other cells in the B2:B10 range. To demonstrate that the reference is relative, select

cell B5 and examine its formula displayed in the Data Validation dialog box. You'll see that the formula for this

cell is

=ISODD(B5)

Generally, when entering a data validation formula for a range of cells, you use a reference to the active cell,

which is normally the upper-left cell in the selected range. An exception is when you need to refer to a specific

cell. For example, suppose that you select range A1:B10 and you want your data validation to allow only values

that are greater than the value in cell C1. You would use this formula:

=A1>$C$1