Microsoft Excel has no built-in "shade alternate lines" button. The fastest path is selecting your range and running Home > Conditional Formatting > New Rule > Use a formula, entering =MOD(ROW(),2)=0, then picking a light fill color. That formula rule is the only method that survives rows you insert, delete, sort, or filter. Static fill and Excel's own banded table styles each break in specific situations covered below.
Why the formula route beats every other method
A formula-driven conditional format recalculates the ROW value every time the sheet changes. Insert a row in the middle and Excel automatically shifts the rule's relative reference, so the stripe pattern re-establishes itself on the new row count. That behavior is the whole reason the method wins.
Compare that to the paint-bucket approach. Selecting every other row by hand and applying a fill takes roughly 40 clicks for 20 rows on a 1080p screen, because row height limits how many rows fit per screen. The formula rule takes seven clicks total regardless of whether you have 20 rows or 20,000.
Static fill also has no memory. Sort the data and the shading stays glued to cell positions, not to records, so a customer who was on a shaded row jumps to a white row while their neighbor does the opposite. The formula rule re-evaluates after the sort and re-stripes cleanly.
One limitation worth stating up front: the ROW function counts physical sheet rows, not visible rows. If you hide rows or apply a filter, the shading rhythm gets gaps. There is a workaround using SUBTOTAL, covered in its own section below, but it costs extra calculation on large sheets.
Step-by-step: applying the MOD/ROW rule in under a minute
Follow these exact steps. The menu names match Excel for Microsoft 365 on Windows as of the 2026 builds; the Mac ribbon uses the same labels in the Conditional Formatting dropdown.
1: Select the range you want striped. Click the first cell, hold Shift, click the last cell, or press Ctrl+A inside a contiguous block. Do not select entire columns unless you intend to stripe the full million-row grid. 2: On the Home tab, click Conditional Formatting, then New Rule. 3: Choose "Use a formula to determine which cells to format" β the last option in the list. 4: In the formula box, type =MOD(ROW(),2)=0 to shade even rows, or =MOD(ROW(),2)=1 to shade odd rows. Do not include a dollar sign before the row number. 5: Click Format, open the Fill tab, pick a light color such as the standard light grey or a pale blue, then click OK twice. 6: Test by inserting a row in the middle of the range. The stripe pattern should shift and stay alternating.
If nothing shades after step 6, the most common cause is a stray absolute reference. If your formula reads =MOD(ROW($A$2),2)=0 with dollar signs, every cell evaluates the same fixed row, so the entire range turns one color or stays blank. Delete the dollar signs. A second common failure is applying the rule to a range that starts on an odd row while using =0 β the first row then sits unshaded and the visual rhythm looks off by one. Switch to =1 or accept the offset.
Locking the stripes to a data start row that isn't row 1
Real worksheets rarely start data at A1. A report might begin on row 4 under a title block, or on row 2 under a header. If you apply =MOD(ROW(),2)=0 starting at row 4, the stripes land on rows 4, 6, 8 β correct alternation, but your first data row is shaded. Some people want the first data row white.
The fix is offsetting the formula to your actual start row. For data beginning on row 4 with the first row unshaded, use =MOD(ROW()-4,2)=1. That expression returns 1 on row 5, 0 on row 4, and flips every row thereafter. For first-row-shaded starting at row 4, use =MOD(ROW()-4,2)=0.
Offset formulas also protect against the row-insertion edge case at the top of the range. If a user inserts a row above row 4, Excel shifts the range down and the offset formula follows it, because the -4 refers to the original relationship. Hard-coded row numbers in absolute references do not follow this way.
One more variant matters for grouped data. If you want three-row banding instead of strict alternation, the formula becomes =MOD(ROW()-4,3)=0 for every third row or =INT((ROW()-4)/3) combined with a lookup for color cycling. Excel's conditional formatting cannot change fill color within a single rule based on a numeric result, so three-color cycling needs three separate rules, each testing for a different remainder value.
Inserting, deleting, and sorting: how the rule holds up in practice
The formula rule is forgiving under normal editing. Insert a row inside a formatted range and the new row inherits the surrounding rule; Excel extends the conditional format range automatically when you insert within it. Delete a row and the range shrinks with your data. Sort the range and the stripe pattern re-evaluates by position, so records move but the visual banding stays continuous.
The edge case is inserting a row at the very top of the range. Excel often extends the formatting downward from the original top, which pushes the first data row's shading off by one relative to your intent. If your range uses an offset formula like =MOD(ROW()-4,2)=1, this shift is usually invisible because the anchor travels with the range. If you used a bare =MOD(ROW(),2)=0, inserting above the range can invert the whole pattern β the row that was shaded becomes unshaded and vice versa.
Copy-and-paste is another silent breaker. Pasting values with "Keep Source Formatting" can drag conditional formatting rules from the source range into your destination, producing duplicate rules that conflict. Use Paste Special > Values when pasting into a striped range, then re-check Conditional Formatting > Manage Rules to confirm only one striping rule exists.
A final caution concerns merged cells. Merged cells collapse multiple rows into one address, and ROW() evaluates to the top-left row of the merged block only. A stripe rule applied across merged ranges produces irregular, unpredictable banding. Unmerge, stripe, then consider whether merged cells are necessary at all β they usually are not.
Shading only visible rows when a filter or hidden rows are in play
The plain ROW function counts every physical row, including hidden ones. Apply a filter that hides rows 10β40 and the visible banding looks broken: two shaded rows might appear back to back where the hidden rows between them contained the unshaded ones.
The fix substitutes AGGREGATE or SUBTOTAL for ROW. Excel's AGGREGATE function, added in Excel 2010 and present in every version since, can count visible rows in a range. A working formula for visible-row striping looks like this: =MOD(SUBTOTAL(103,$A$2:$A2),2)=0. The 103 argument counts non-blank visible cells, so as Excel evaluates each row it returns a running count of visible rows above and including the current one.
The hidden cost is performance. That SUBTOTAL runs per cell, so a 10,000-row range with 8 columns runs 80,000 SUBTOTAL calculations on every recalculation event. On a modern machine the delay is imperceptible for 1,000 rows and noticeable β roughly 0.5β2 seconds per recalc β at 20,000 rows. If the sheet recalculates constantly because of live formulas, the plain ROW version stays snappier and accepts the filter gap as a cosmetic tradeoff.
Test the SUBTOTAL rule by applying a filter and scrolling. If the stripes re-align to the visible rows, the rule is working. If they stay fixed to physical rows, your formula is still using ROW rather than SUBTOTAL, or the range reference inside SUBTOTAL is wrong β it must be a single column with mixed absolute and relative anchoring, like $A$2:$A2.
Banded table styles: one keyboard shortcut and its three limits
Excel's Format as Table feature applies built-in banded row shading with zero formulas, and it is the only method that gives you the stripe in one keystroke. Select your data, press Ctrl+T, confirm the range, and Excel converts the range to a structured table with alternating row shading on by default. The Table Design tab exposes a "Banded Rows" checkbox if you ever switch it off.
The default style in Excel for Microsoft 365 is Blue, Table Style Medium 2, a medium blue header with pale blue alternating stripes. You can right-click through Table Design > Table Styles to pick a lighter color, or right-click Table Design > New Table Style to build a custom stripe with any two fills you like.
Three limits matter. First, a table requires unique header names; duplicate headers get renamed to "Column1" and similar, silently altering your header row. Second, structured tables cannot contain merged cells, so any merged-cell layout has to be unmerged before conversion. Third, table styles shade only the table body, not rows below it β if someone appends data outside the table's last row, the stripe disappears for those rows. The table's auto-expansion helps when you type directly in the cell just below the last row, but copying and pasting a block below the table does not always trigger expansion.
A subtle bonus: the Ctrl+T table keeps its banding intact through sort, filter, and row insertion without any conditional-format bookkeeping. For a plain data table that doesn't need merged cells, it is often the faster choice than the formula method.
Fastest manual alternative: copy-paste a shaded row pair
When you need stripes on a small range β say 10 to 30 rows, one time β the manual paint-bucket technique actually beats the conditional-format setup on total clicks. Here is the trick that cuts it down: shade row 1, then shade row 3, then select rows 1 through 4 together and drag the fill handle down.
1: Select row 2 by clicking the row header. Set the fill to your light color. 2: Select row 4 the same way. Set the same fill. 3: Select rows 1 through 4 as a block by dragging row headers 1 to 4. 4: Grab the small square fill handle at the bottom-right corner of the selection and drag down to your last row.
Excel copies the fill pattern of four rows, which alternates the shading correctly. You reach the end of the range in one drag instead of 20 separate selections. For 20 rows that is four actions versus roughly 40 clicks with single-row painting.
The catch is durability. As soon as anyone sorts, inserts, or pastes into the range, the stripes break. Use this method for a one-off printout, not for a live tracker. If the sheet will be edited by anyone else, invest the extra 30 seconds in the conditional-format rule.
Color choices that survive printing and grayscale viewers
A stripe color that looks gentle on a bright monitor can vanish when printed to a monochrome laser printer or viewed on a projector in a daylight room. Choose a fill whose luminance difference from white is at least 10 percentage points. The standard "White, Background 1, Darker 10%" swatch in Excel's theme colors sits at roughly 90% luminance β visible in grayscale but subtle on screen.
Pale blue at RGB 217, 226, 243 (Excel's Blue, Accent 1, Lighter 80%) and pale grey at RGB 242, 242, 242 (White, Background 1, Darker 5%) are the two safest defaults. The 5% grey is often too faint for printing; the 10% grey survives most laser printers.
Avoid fill colors with high saturation for stripe rows. A saturated yellow or green behind every other row competes with cell text for attention and slows down reading numbers in a column. The standard Excel table style Medium 2 uses exactly this principle: a barely perceptible pale tint layered over white, so the alternate rows read as groups rather than as separate records.
To confirm print behavior before committing, switch to View > Page Layout. The on-screen preview approximates the printer output more closely than Normal view because printer drivers render fills differently. If the stripe is invisible in Page Layout, it will be invisible in print.
Diagnosing the four silent failures
Striping rules fail quietly. Excel does not warn you when a conditional format stops working; the cells simply turn white. Here are the four failure patterns you will actually encounter, with the check that isolates each one.
| Symptom | Likely cause | Fix |
|---|---|---|
| Every cell in range is one solid color | Absolute row reference in formula, e.g. ROW($A$2) | Replace with ROW() or ROW(A2) relative |
| Stripes shifted by one row from intent | Rule applied starting on an odd row with =MOD(ROW(),2)=0 | Change 0 to 1, or add an offset like -4 |
| Stripes break after filter is applied | ROW counts hidden rows | Switch to a SUBTOTAL-based formula |
| Stripes appear only outside the table body | Data is a Ctrl+T table; rule applies to cells outside it | Either add the rule to the table, or use banded rows in Table Design |
A fifth, less obvious failure is color overlap. If you have two conditional rules on the same range β say one that highlights overdue invoices in red and another that stripes rows β both rules run and the "Stop If True" checkbox in Manage Rules determines which wins. Put the stripe rule first in the list with Stop If True unchecked so highlighting rules can override, or vice versa, depending on which signal you want to see. Test the priority by toggling Stop If True and observing which color wins on a test cell.
FAQ
What is the formula to shade every other row starting from row 2?
Use =MOD(ROW(),2)=0 on a range that begins at row 2. That returns TRUE on every even-numbered physical row, so rows 2, 4, 6, 8 shade while odd rows stay white. If your range starts at row 3 instead, the same formula shades the first row of the range and you may want =1 to keep row 3 white.
Why does my alternate row shading disappear after I filter the data?
ROW counts physical rows, including hidden ones from the filter. When rows collapse, the visible banding looks broken. Replace ROW with SUBTOTAL: =MOD(SUBTOTAL(103,$A$2:$A2),2)=0. The 103 argument counts non-blank visible cells, so the running count matches what you see on screen. The tradeoff is extra recalculation cost on very large ranges.
Can I shade every third row instead of every other row?
Yes, with =MOD(ROW(),3)=0 for every third row beginning on row 3, or =MOD(ROW()-2,3)=0 for a different alignment. Excel can only produce one fill color per conditional-format rule, so a three-color cycle needs three rules, each testing a different remainder from the MOD function and set with a different fill.
Does Format as Table (Ctrl+T) do the same thing as a conditional format rule?
No. A table applies its own banded style directly to the range, not through a conditional rule, so you cannot inspect or edit it in Conditional Formatting > Manage Rules. Tables also reject merged cells and require unique headers. In exchange, one keystroke beats the seven-click formula setup, and tables usually survive column reordering more gracefully.
What happens to the stripes if I sort the data?
With a formula rule, Excel re-evaluates ROW after the sort, so the visual banding stays continuous and each record carries its shading to the new position. With a static paint-bucket fill, the color stays glued to the cell address and the sorted result looks scrambled. Sort is the single strongest argument for the formula rule over manual shading.
Can I shade rows only within a specific column set, not the whole row width?
Yes, select only columns B through F (for example) before applying the rule, and the shading will never bleed into column A or column G. The formula still evaluates ROW, so the stripe continues across the selected width. If you later insert a column inside the selected range, Excel extends the format; if you insert outside it, you must reapply the rule to include the new column.
What is the fastest way to remove all alternate-row shading from a sheet?
For formula-based stripes, press Ctrl+A to select the sheet, then Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells (or Clear Rules from Entire Sheet). For Ctrl+T tables, right-click any cell in the table, choose Table > Convert to Range, then select and clear the fill. For manually painted stripes, select the range and press Alt+H+H+N in Excel 365 to jump straight to No Fill.
Does the same formula work on Excel for Mac and in Excel for the web?
Yes. The Conditional Formatting menu, the "Use a formula" option, and the MOD and ROW functions exist identically in Excel for Mac 2016 and later and in Excel for the web. Menu locations shift slightly on the Mac ribbon but the option labels are the same. The web version does not support custom table styles, so the Ctrl+T route loses custom colors there; the formula route works fully.