Summary

If you want to highlight every other row in a table (sometimes called zebra striping) with conditional formatting you can do so with a simple formula that uses either the ISEVEN or ISODD function. For example, if you want to highlight every other row in the range B3:F102 select the entire range then create a conditional formatting rule that uses this formula:

=ISEVEN(ROW())

Generic formula

=ISEVEN(ROW())

Explanation 

When you use a formula to apply conditional formatting, the formula is evaluated for every cell in the selection. In this case, there are no addresses in the formula, so, for every cell in the data, the ROW and ISEVEN functions are run. ROW returns the row number of the cell, and ISEVEN returns TRUE if the row number is even and FALSE if the row number is odd. The rule will trigger on TRUE, so even rows will be shaded.

To shade odd rows, just use ISODD instead:

=ISODD(ROW())

A MOD alternative

If you're using an older version of Excel (before 2007) you may not have access to ISEVEN and ISODD. In that case, you can use the "classic" formula for shading even or odd rows, which depends on the MOD function:

=MOD(ROW(),2) = 0 // returns true for even rows
=MOD(ROW(),2) = 1 // returns true for odd rows

MOD takes a number and a divisor as arguments, and returns the remainder. The ROW function provides the number, which is divided by 2, so MOD returns zero when the row is an even number and 1 if not.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.