|
Home > Format > Conditional > Row Color
Excel Alternate Row Colour - Examples
|

|
Use Excel conditional formatting to colour alternating rows
on the worksheet, or shade groups of rows, to see where weeks begin.
|
|

1) Shade Every Other Row
In the screen show below, cells are coloured light orange, for odd-numbered rows. This alternate row color can make it easier to read across a wide row of data.

1.1) Create Alternate Row Colouring
- First, select
all the cells where you want rows in alternating colours
- In the screen shot above, I selected cells A1:C5
- On the Ribbon's Home tab, click Conditional Formatting, then click
New Rule
- Click Use a Formula to Determine Which Cells to Format
- Then, from the first dropdown, choose Formula Is
- For the formula, enter =MOD(ROW(),2)
- Click the Format button.
- On the Patterns tab, select a colour for shading
- Click OK, click OK
1.2) How the MOD Formula Works
The MOD function has 2 arguments - number and divisor. MOD returns the remainder, after the number is divided by the divisor
In the conditional formatting formula:
- =MOD(ROW(),2)
- number is the row number - ROW()
- divisor is 2 (number of rows in each set)
1.2.1) Odd and Even Rows
Conditional formatting is applied when the formula result is TRUE
Even: For even row numbers, the result is 0 (zero) - no remainder
- In Excel, a zero is FALSE, so even rows will NOT be coloured orange
Odd: For odd row numbers, the result is 1
- In Excel, a 1 is TRUE, so odd rows WILL be coloured orange

2) Shade Bands of Rows
You can use Excel conditional formatting to shade bands of multiple rows on the worksheet.
In this short video, I show how to set up colour bands, using the MOD function in conditional formatting. There are written steps below the video.
2.0.1) Alternating Colour Bands - Example
In the example below, there are alternating colour bands, with 4 rows in each set:
- Green: First 2 rows are shaded light green
- No Fill: Next 2 rows are left with no shading

2.1) Create Alternate Band Colouring
- First, select
all the cells where you want bands of rows in alternating colours
- In the screen shot above, I selected cells A1:C9
- On the Ribbon's Home tab, click Conditional Formatting, then click
New Rule
- Click Use a Formula to Determine Which Cells to Format
- Then, from the first dropdown, choose Formula Is
- For the formula, enter =MOD(ROW()-1,4)<2
- Click the Format button.
- On the Patterns tab, select a colour for shading
- Click OK, click OK
2.2) How the MOD Formula Works
The MOD function has 2 arguments - number and divisor. MOD returns the remainder, after the number is divided by the divisor
In this conditional formatting formula:
- =MOD(ROW()-1,4)<2
- number is the row number, minus 1 - ROW()-1
- divisor is 4 (number of rows in each set)
- Result for MOD will be 0, 1, 2 or 3
- Excel checks if the MOD result is less than 2 - TRUE or FALSE
2.2.1) Result Less Than 2
Conditional formatting is applied when the formula result is TRUE
- TRUE: For the first 2 rows in each set, the MOD result is less than 2
- Those cells are formatted with light green fill
- FALSE: For the next 2 rows in each set, the MOD result is NOT less than 2
- Those cells are not formatted - they remain with no fill colour
In the screen shot below, I entered the following MOD formula in column B, to show the MOD result for each row.
- Rows with 0 or 1, get light green fill colour from conditional formatting

3) Shade Bands by Group
You can use Excel conditional formatting to create alternating colour bands by group. In the example shown below, the rows are in alternating colours, based on their week numbers.

3.1) TRUE or FALSE Column
First, to prepare the table for shade bands by group, I followed these steps, to add a new column:
- In cell D1, type the heading for a new column - TRUE
- In cell D2, enter this formula, which compares the week number to the row above, and returns TRUE or FALSE.
3.2) Add Conditional Formatting
Next, follow these steps to add the conditional formatting:
- Select all the data cells in the table (not the heading cells)
- On the Home tab, click Conditional Formatting, New Rule
- Click on "Use a formula to determine which cells to format"
- In the formula box, type this formula, referring to the active data cell:
- Click the Format button, and choose a fill colour (I chose light blue)
- Click OK, twice, to apply the formatting
- (Optional) Hide the TRUE/FALSE column, to tidy up the worksheet.
Note: This technique was adapted from Chip Pearson's site.
4) Shade Alternating Filtered Rows
You can use Excel conditional formatting to shade alternating rows
in a filtered list.
The visible rows will show alternating colours, like the filtered list below.

4.1) Add Conditional Formatting
To set this up in the sample file, I followed these steps, to add the conditional formatting:
- First, remove any filters from the list, so all the rows are visible
- Nelect the data cells in the list (A2:B29 in this example).
- On the Ribbon's Home tab, click Conditional Formatting, then click
New Rule
- Click Use a Formula to Determine Which Cells to Format
- For the formula, enter:
- =MOD(SUBTOTAL(3,$A$1:$A2),2)
- The SUBTOTAL function counts the visible rows, down to the current row
- MOD divides that number by 2
- Result will be 1 (TRUE), or 0 (FALSE)
- Click the Format button.
- On the Patterns tab, select a colour for shading
- Click OK, click OK
4.2) Test the Row Colouring
Filter the list, and the shading will alternate in the visible
rows.
For example, in the drop down list in the Month heading, select Jan and Apr only
- At the left side of the sheet, the row numbers are blue, to show that a filter is applied
- In the list, the visible rows are in alternating colours of green, and no fill.

5) Get the Excel Files ✅
Alternate Rows: Download the Excel Alternate Row Colours file, with the examples from this page. The zipped Excel file is in xlsx format, and does not contain any macros.
Get Monthly Excel Tips!
Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.
Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!
More Tutorials
Conditional Format Intro
Conditional Format Examples
Highlight Duplicates
Hide/Show Questions
Color Scales | Icon Sets | Data Bars