When you are staring at a massive Microsoft Excel spreadsheet containing thousands of rows of financial data, your eyes can easily lose track of the line as you read from the left side of the screen to the right. To improve readability, professional analysts use “zebra striping”—highlighting every alternating row in a subtle grey color. While you could apply this formatting to a static table using Excel’s built-in Table tools, doing so programmatically using Conditional Formatting and the ISEVEN (or ISODD) function gives you absolute control over the design.
Understanding the ISEVEN and ISODD Functions
The mathematical functions =ISEVEN(number) and =ISODD(number) are incredibly simple. They evaluate a number and return TRUE or FALSE.
=ISEVEN(4)returns TRUE.=ISEVEN(5)returns FALSE.
To zebra stripe a spreadsheet, we combine these functions with the ROW() function. The formula =ISEVEN(ROW()) asks Excel to look at the current row number. If the row number is even (e.g., Row 2, Row 4), the formula evaluates to TRUE. We can use this boolean logic to trigger a background color change.
How to Apply Alternating Row Colors
You must apply this logic through the Conditional Formatting menu so that the colors automatically update even if you insert or delete rows later.
- Highlight the entire dataset you want to format. If you want the formatting to apply to the entire worksheet, click the small triangle in the extreme top-left corner of the grid (above Row 1 and left of Column A) to select everything.
- Navigate to the Home tab on the ribbon menu.
- Click Conditional Formatting, then select New Rule… from the drop-down list.
- In the dialog box, select the final option: Use a formula to determine which cells to format.
- In the formula text box, type exactly:
=ISEVEN(ROW()) - Click the Format… button.
- Go to the Fill tab and select a very light, subtle color (like light grey or pale blue). Click OK.
- Click OK one final time to apply the rule.
Customizing the Striping Pattern
Instantly, every even-numbered row on your screen will turn grey, while the odd-numbered rows remain white, creating a perfect zebra stripe. If you delete Row 3, Excel will immediately recalculate the math and instantly shift the colors so the alternating pattern never breaks.
If your dataset has a heavy, dark header on Row 1 and you prefer the colored stripes to start on Row 3 instead of Row 2, simply repeat the process above but change the formula in step 5 to =ISODD(ROW()).