Excel 2010 Bible

(National Geographic (Little) Kids) #1

Chapter 20: Visualizing Data Using Conditional Formatting


497


Displaying alternate-row shading
The conditional formatting formula that follows was applied to the range A1:D18, as shown in
Figure 20.16, to apply shading to alternate rows.

=MOD(ROW(),2)=0

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 function
(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.

FIGURE 20.16

Using conditional formatting to apply formatting to alternate rows.


Creating checkerboard shading
The following formula is a variation on the example in the preceding section. It applies formatting
to alternate rows and columns, creating a checkerboard effect.

=MOD(ROW(),2)=MOD(COLUMN(),2)

Shading groups of rows
Here’s another rows shading variation. The following formula shades alternate groups of rows. It
produces four rows of shaded rows, followed by four rows of unshaded rows, followed by four
more shaded rows, and so on.

=MOD(INT((ROW()-1)/4)+1,2)
Free download pdf