Highlight Every Nth Row

Excel Formulas › Conditional Formatting

All versionsMOD

Shade every 3rd row (or 5th, or 10th) for readability with a MOD rule on the row number — a clean band pattern that survives sorting and filtering.


Quick formula: select the range, add a formula rule:
=MOD(ROW(), 3) = 0
ROW() gives each cell’s row number; MOD(…, 3)=0 is TRUE on every 3rd row.

Functions used (tap for the full reference guide):

The example

Every third row shaded.

AB
1RowShaded?
23yes
36yes

The formula

The conditional-formatting rule:

=MOD(ROW(), 3) = 0 // TRUE on rows 3, 6, 9 ...

How it works

MOD on the row number creates the cycle:

  1. ROW() returns the current cell’s row number.
  2. MOD(number, 3) gives the remainder when divided by 3 — it cycles 1, 2, 0, 1, 2, 0…
  3. = 0 picks every 3rd row; change 3 to band at a different interval.
  4. Offset the start by subtracting: MOD(ROW()-1, 3)=0 shifts which rows light up.

Banding by group, not row? See the shade-alternating-groups recipe — this MOD rule bands by position, which is what you want for fixed stripes but not for variable-size groups.

Try it: interactive demo

Live demo

Shade every Nth row.

Variations

Offset the start

Shift which rows:

=MOD(ROW()-1, 3) = 0

Every other row

Classic stripes:

=ISEVEN(ROW())

Every Nth column

Use COLUMN():

=MOD(COLUMN(), 3) = 0

Pitfalls & errors

ROW() is absolute. It returns the sheet row, so the pattern is tied to position, not to your data’s first row — offset with -1/-startRow if needed.

Banding moves with rows. Insert a row and the stripes re-flow — expected, since it’s based on row number.

For a Table, use built-in banding. Excel Tables have banded rows as a style option — simpler than a MOD rule there.

Practice workbook

📊
Download the free Highlight Every Nth Row practice workbook
Every-Nth-row CF rule applied, with offset and column variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I shade every Nth row in Excel?
Add a formula CF rule =MOD(ROW(), N) = 0. ROW() gives the row number and MOD picks every Nth one.
How do I shift which rows are shaded?
Offset the row number: =MOD(ROW()-1, 3) = 0 shifts the pattern by one.
How do I band columns instead?
Use COLUMN(): =MOD(COLUMN(), 3) = 0 shades every Nth column.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Banded rows · Shade alternating groups · MOD function

Function references: MOD · ROW