Part I: Getting Started with Excel
Notice that a mixed reference is used for cell A3. Because the column part of the reference
is absolute, the comparison is always done using the contents of column A.
Displaying alternate-row shading
The conditional formatting formula that follows was applied to the range A1:D18, as shown
in Figure 5.19, to apply shading to alternate rows:
=MOD(ROW(),2)=0
FIGURE 5.19
Using conditional formatting to apply formatting to alternate rows
Alternate row shading can make your spreadsheets easier to read. If you add or delete rows
within the conditional formatting area, the shading is updated automatically.
This formula uses the ROW function (which returns the row number) and the MOD func-
tion (which returns the remainder of its first argument divided by its second argument).
For cells in even-numbered rows, the MOD function returns 0 , and cells in that row are
formatted.
For alternate shading of columns, use the COLUMN function instead of the ROW function.
Creating checkerboard shading
The following formula is a variation on the example in the preceding section. It applies format-
ting to alternate rows and columns, creating a checkerboard effect.
=MOD(ROW(),2)=MOD(COLUMN(),2)