Excel: Color Every Second Row (Step-by-Step)
In this article
To color every second row in Excel, use a formula-based conditional formatting rule with the MOD and ROW functions: select your data range, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, enter =MOD(ROW(),2)=0, and choose a fill color. This applies banding that updates automatically when you insert or delete rows. Alternatively, convert your range to an Excel Table (Ctrl+T) and pick a banded table style, which shades alternating rows without any formula. Both methods work in Excel for Microsoft 365, Excel 2021, 2019, and 2016 on Windows and Mac; menu labels may differ slightly by version and region.
What You'll Need
- Excel 2016 or later (Windows or Mac) or Microsoft 365
- A worksheet with data in rows
- No add-ins required
Step-by-Step
- Select the range you want to shade. Click the first cell of your data and drag to the last cell, or press Ctrl+A (Windows) / Command+A (Mac) to select the current region. Include only the rows you want banded; do not select entire columns unless you want the shading to run to the bottom of the sheet.
- Open Conditional Formatting. On the Home tab, click Conditional Formatting > New Rule. (On Mac, the button is also on the Home tab.)
- Choose the formula option. In the New Formatting Rule dialog, select "Use a formula to determine which cells to format."
- Enter the formula. In the formula box, type
=MOD(ROW(),2)=0. This shades even-numbered rows. To shade odd-numbered rows instead, use=MOD(ROW(),2)=1. The formula is relative to the active cell of your selection, so Excel applies it correctly across the whole range. - Set the fill color. Click Format, go to the Fill tab, pick a light color (such as light gray or a pale blue), and click OK. Avoid dark colors that make text hard to read.
- Apply the rule. Click OK again to close the New Formatting Rule dialog. The alternating rows should now be shaded.
- Test that it updates. Insert a row in the middle of your data (right-click a row number > Insert). The banding should shift automatically because the rule uses ROW(), which recalculates. If you used a static fill instead, the pattern would break.
If you prefer a no-formula approach, select your range and press Ctrl+T (Windows) or Command+T (Mac) to create a Table. In the Table Design tab (called Table on Mac), choose a style with banded rows from the gallery. The Banded Rows checkbox is on by default. Tables also expand automatically when you add data, and the banding stays consistent.
Common Mistakes
- Using a fixed range in the formula. Writing
=MOD(ROW($A$2),2)=0or referencing a specific cell instead of ROW() makes the rule shade the same rows regardless of position. Use ROW() with no argument. - Applying the rule to the wrong starting row. If your data starts on row 2 and you want the first data row shaded, use
=MOD(ROW(),2)=0only if row 2 is even. Otherwise switch to=MOD(ROW(),2)=1or adjust with an offset like=MOD(ROW()-2,2)=0. - Selecting entire columns. Formatting whole columns (e.g., A:A) can slow down large workbooks and shade empty rows far below your data. Select only the used range.
- Forgetting that conditional formatting overrides manual fill. If cells already have a fill color, the rule may not appear to work. Clear existing fills first (Home > Fill Color > No Fill) or remove conflicting rules.
- Assuming the Table style is permanent. Converting a Table back to a normal range (Table Design > Convert to Range) removes the banding unless you also applied conditional formatting.
Tips
- Use a light fill (e.g., #F2F2F2) so the banding aids readability without distracting from the data.
- To band by groups of rows (e.g., every three rows), use
=MOD(ROW()-1,3)=0and adjust the divisor. - If you need to copy the formatting to another sheet, copy a cell with the rule and use Paste Special > Formats, or recreate the rule on the new range.
- For printing, check that the banding appears in Print Preview; conditional formatting prints by default, but table styles may be affected by print settings.
- Combine banding with a top border on each row for a cleaner look, but keep it subtle.
Troubleshooting
- No shading appears: Check that the rule is enabled (Conditional Formatting > Manage Rules) and that the formula is exactly
=MOD(ROW(),2)=0with no extra spaces. Also confirm the range in "Applies to" covers your data. - Shading is offset by one row: Your data may start on an odd row. Change the formula to
=MOD(ROW(),2)=1or use an offset like=MOD(ROW()-1,2)=0. - Banding disappears after sorting: Conditional formatting with ROW() recalculates after sorting, so the banding will follow the new row positions, which may look like it moved. If you need banding tied to specific records, use a helper column with a static flag and base the rule on that column instead.
- Table style banding not showing: In Table Design, ensure "Banded Rows" is checked. If you have manually filled cells, the table style may be hidden; clear manual fills.
- Performance is slow: Limit conditional formatting to the used range rather than entire columns, and avoid multiple overlapping rules.
Frequently Asked Questions
Can I color every second row without conditional formatting?
Yes. Convert your range to an Excel Table (Ctrl+T) and choose a banded table style. The banding is applied automatically and adjusts as you add or remove rows.
How do I shade every third row instead of every second?
Use a formula like =MOD(ROW()-1,3)=0 in the conditional formatting rule. Adjust the divisor (3) to change the group size.
Will the banding stay if I insert or delete rows?
Yes, if you used a ROW()-based conditional formatting rule or an Excel Table. Static fills will not adjust.
Why does my conditional formatting not apply to the whole row?
Make sure the "Applies to" range in Manage Rules covers all columns you want shaded. If you selected only one column when creating the rule, it will only shade that column.
Can I use this in Excel for the web?
Yes, conditional formatting with formulas is supported in Excel for the web, though the interface may differ slightly. Table styles are also available.
How do I remove the banding later?
Select the range, go to Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. For a Table, convert it to a range or uncheck Banded Rows in Table Design.