In this video, we'll look at how to use conditional formatting to shade every other row in a table. This is sometimes called "zebra striping".
In this spreadsheet, we have a table of employees with a minimal amount of formatting. To get shading on every other row, I could just convert this table to a proper Excel Table using Control + T, then customize the format as desired.
This is a good option, especially if you want the table for other reasons as well.
However, you can also apply dynamic zebra striping with conditional formatting and a formula.
The classic formula for zebra striping uses the MOD function. MOD takes a number and a divisor, and then returns the remainder. So, if I use the ROW function, without a reference, to get number of the current ROW, and then use 2 as the divisor, the MOD function returns zero when the row is an even number and 1 if not.
If I copy this formula across multiple cells, you can see we get rows of ones and zeros. We can use these results directly in a conditional formatting rule, since 1 and zero are equivalent to TRUE and FALSE.
So, to add the striping, I can just create a new conditional format rule based on a formula...then add the formula, and set a fill color.
If you'd rather shade even rows, just add "= 0" to the formula to switch the logic.