To shade every other row in Excel, select your data range, go to Home > Conditional Formatting > New Rule, choose Use a formula to determine which cells to format, enter =MOD(ROW(),2)=0, and set a fill color. This applies a banded-row effect that updates automatically as you add or delete rows.
Why Banded Rows Matter
Alternating row shading, often called “zebra striping,” is a readability technique that helps the eye track a single row across a wide table. Without it, scanning a spreadsheet with many columns can cause you to lose your place, especially when values repeat. The effect is common in financial reports, schedules, and inventory lists. Excel offers several ways to achieve it, each with different trade-offs in flexibility, automation, and compatibility.
Method 1: Conditional Formatting (Best for Dynamic Data)
Conditional formatting is the most robust method because it reacts to changes in your data. Here’s the exact process:
- Select the range you want to format (for example,
A2:F20). - Go to Home > Conditional Formatting > New Rule.
- Choose Use a formula to determine which cells to format.
- In the formula box, type
=MOD(ROW(),2)=0to shade even rows, or=MOD(ROW(),2)=1for odd rows. - Click Format, pick a fill color, and press OK twice.
The ROW() function returns the current row number, and MOD returns the remainder after division by 2. A remainder of 0 means even, 1 means odd. If your data starts on row 5, you might want to base the pattern on the data row, not the sheet row. Use =MOD(ROW()-5,2)=0 to start with the first selected row as “even.”
This method works in Excel for Microsoft 365, Excel 2021, 2019, and older versions. On a Mac, the steps are identical, but the ribbon layout is slightly different—look for Conditional Formatting under the Home tab as well. In Excel for the web, the same formula works, but you must access it via Home > Conditional Formatting > New Rule.
Method 2: Excel Table Styles (Simplest for Static Data)
If your data is already in a proper Excel table (created with Ctrl+T on Windows or Cmd+T on Mac), banding is built in. By default, a table applies alternating row shading. To change the color scheme:
- Click anywhere inside the table.
- Go to the Table Design tab (called Table on Mac).
- In the Table Styles gallery, pick a style with “Banded Rows” enabled—most styles have it by default.
- If you want no banding, uncheck Banded Rows in the Table Style Options group.
This method is perfect when you don’t need custom colors and want the table to automatically expand when you add new rows. However, it only works inside a table—not on a plain range. Also, if you convert the table back to a range (via Table Design > Convert to Range), the banding disappears unless you reapply conditional formatting.
Method 3: Manual Fill (Only for One-Time Use)
You can manually select alternating rows and fill them with a color using the Fill Color button (the paint bucket icon) on the Home tab. To do this efficiently:
- Select the first row you want shaded.
- Hold Ctrl (Windows) or Cmd (Mac) and click the row numbers of every other row you want to include.
- Click the fill color and choose a shade.
This is quick for a small, static range, but it has serious downsides. If you insert or delete a row, the pattern breaks. If you sort the data, the shading moves with the rows, which may look odd. It’s fine for a one-off report you won’t edit, but not for ongoing work.
How to Choose Between the Methods
Consider these factors when deciding:
- Will the data change? Use conditional formatting or a table. Manual fill will fail.
- Do you need to filter or sort? A table handles this gracefully; conditional formatting also works but the formula stays fixed to the original row numbers.
- Do you want to control the exact color? Conditional formatting gives you any RGB color. Table styles offer preset palettes only.
- Are you sharing the file with people using older Excel? Conditional formatting works in Excel 2007 and later. Table styles also work, but the design may differ.
- Does your data start on a specific row? Adjust the formula with
ROW()-startingRowto keep the pattern aligned.
For most users, conditional formatting is the best balance of flexibility and automation. It doesn’t require converting your range into a table, and it survives sorting (though the pattern stays tied to the row number, not the data).
Common Problems and Fixes
Here are typical issues you might encounter:
- The shading doesn’t appear. Check that the formula is correct and that the range you selected is the same as the range in the rule. Also, ensure you clicked Format and chose a fill color—if you only set a font color, nothing visible happens.
- Every row is shaded. Your formula might be
=MOD(ROW(),2)=0but you applied it to a range that starts on row 1, making all rows even? No—row 1 is odd, row 2 even, so only even rows shade. If all rows shade, you likely used=MOD(ROW(),2)<2or forgot the equals sign. Double-check the formula. - Shading breaks when I insert a row. Conditional formatting adjusts automatically when you insert rows within the range. If you insert a row above the range, the pattern shifts because row numbers change. To keep the pattern anchored to the data, include a header row in the range and start the formula at the first data row.
- I want to shade every 3rd row, not every other. Change the divisor in the MOD function:
=MOD(ROW(),3)=0shades rows 3, 6, 9, etc. For every 4th, use=MOD(ROW(),4)=0. - The table style doesn’t show banding. Go to Table Design and check that Banded Rows is ticked in the Table Style Options group.
Alternatives and Advanced Variations
If you want more control, consider these variations:
- Shade based on a column value: Instead of row number, use a formula like
=MOD(COUNTIF($A$2:$A2,$A2),2)=0to shade groups of identical values in column A. This is useful for categorized data. - Shade only visible rows after filtering: Use
=SUBTOTAL(103,$A2)in a formula to detect if a row is hidden. Combine with MOD:=AND(MOD(ROW(),2)=0,SUBTOTAL(103,$A2)=1)to shade only visible even rows. - Use a custom VBA macro to apply banding to a selection. For example, a simple macro that loops through rows and sets the
Interior.Colorproperty. Remember to save a copy of your workbook before running any macro, as the changes cannot be undone with Ctrl+Z.
Here is a small VBA example that shades even rows in the selected range:
Sub ShadeEvenRows()
Dim rng As Range
Dim row As Range
Set rng = Selection
For Each row In rng.Rows
If row.Row Mod 2 = 0 Then
row.Interior.Color = RGB(221, 235, 247)
End If
Next row
End Sub
This code checks each row’s number and applies a light blue fill to even rows. It’s a one-time operation, not dynamic.
Frequently Asked Questions
How do I remove the shading later? Select the range, go to Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. If you used a table, go to Table Design and uncheck Banded Rows. For manual fill, select the rows and choose No Fill from the fill color dropdown.
Does conditional formatting slow down my workbook? With a few hundred rows, no. With tens of thousands of rows, it can slow recalculations, especially if you have many rules. To improve performance, limit the range to the actual data, not entire columns.
Can I use a different color for odd and even rows? Yes. Create two conditional formatting rules: one with =MOD(ROW(),2)=0 and a fill color, another with =MOD(ROW(),2)=1 and a different fill. Make sure the rules don’t conflict—set the “stop if true” option if needed, but for fills, they don’t overlap.
Why does my formula use ROW() but the shading is off by one? Because ROW() returns the actual sheet row number. If your data starts on row 3, row 3 is odd, but you might want it to be the first banded row (even). Adjust the formula to =MOD(ROW()-3,2)=0 to make row 3 the “even” row.
Does this work in Google Sheets? Yes, the same formula works, but the menu path is different: Format > Conditional formatting, then under “Format cells if” choose “Custom formula is” and enter the same MOD formula. Google Sheets also has a built-in “Alternating colors” option under Format > Alternating colors.
Can I print with the shading? Yes, but ensure your printer settings include background colors. Go to Page Layout > Page Setup > Sheet and check “Print” under “Gridlines” or “Black and white” if you want to save ink. Conditional formatting prints by default.
Related
- Generate 20 Random Numbers: How to Do It
- Balance Sheet Account Section: What It Is and How It Works
- How to Combine Spreadsheets in Excel: 5 Ways
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Random Number 0-9: How to Generate ThemYes, you can randomly generate numbers from 0 to 9 using a simple formula in any spreadsheet program:…
- How to Add Reference Footnotes in Word, Step by StepTo add a reference footnote in Word, place the cursor after the passage you are citing, choose References…
- Google Sheets Calendar: Create and Customize Your OwnYes, you can create a calendar in Google Sheets, either by adapting a template or building a date…
- Google Sheets Budget Template: Build or Choose OneA Google Sheets budget template is a spreadsheet that organizes income, planned spending, and actual spending so you…
- How to Create a Template in Outlook 2016To create an email template in Outlook 2016 for Windows, compose a message, choose File > Save As,…
- Real Estate Excel Template for Cash Flow: Build OneA real estate Excel cash-flow template can track monthly rent, other income, vacancy, operating costs, capital spending, loan…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.