## Highlight every other row

Here is how to highlight every other row using conditional formatting.

**Conditional formatting formula:**

**Alternative CF formula:**

This formula colors every second row if any cell in the row is populated. If you know you will add more records later to the list, select and conditional format a range larger than the list. Empty rows won´t be formatted.

**How to apply the conditional formatting formula in excel 2007:**

- Select the range, example cell range A:C
- Press with left mouse button on "Home" tab on the ribbon
- Press with left mouse button on "Conditional formatting"
- Press with left mouse button on "New rule..."
- Press with left mouse button on "Use a formula to determine which cells to format"
- Press with left mouse button on "Format values where this formula is true" window.
- Type =ISEVEN(ROW())*OR($B3:$D3<>"")
- Press with left mouse button on Format button
- Press with left mouse button on "Fill" tab
- Select a color
- Press with left mouse button on OK!
- Press with left mouse button on OK!

### Explaining the contional formatting formula in cell A2

=ISEVEN(ROW())*OR($A2:$C2<>"")

**Step 1 - Check if row number is even**

=**ISEVEN(ROW())***OR($A2:$C2<>"")

ISEVEN(ROW())

becomes

ISEVEN(2)

returns TRUE in cell A2.

**Step 2 - Check if any of the cells in row are not empty**

=ISEVEN(ROW())***OR($A2:$C2<>"")**

OR($A2:$C2<>"")

becomes

OR({"Federer", " Roger ", 25}<>"")

becomes

OR({TRUE, TRUE, TRUE})

and returns TRUE

**Step 3 - Multiply functions (AND logic)**

Both functions need to return TRUE in order to return TRUE

=ISEVEN(ROW())*OR($A2:$C2<>"")

becomes

TRUE*TRUE

and returns TRUE. Row 2 is conditional formatted.

### Get excel sample file for this tutorial

color-every-second-row-using-dynamic-conditional-formatting.xls

(Excel 97-2003 Workbook *.xls)

**Functions used in this article**

**OR(**logical1, logical2, …**)**

Checks whether any of the arguments are TRUE and returns TRUE or FALSE. Returns FALSE only if all arguments are FALSE

**ROW(**reference**)**

Returns the row number of a reference

**ISEVEN(**number**)**

Returns TRUE if the number is even

### Cf misc category

Question: I have a list that I keep adding rows to. How do i create a border that expands as […]

This article demonstrates how to apply different cell formatting to a cell range based on a Drop Down list, column […]

The picture above shows Conditional Formatting highlighting cells in cell range F3:Y22 based on row and column values in column B […]

Pamela asks: I would like to ask you how to identify PAIR of same numbers, but with a different sign. […]

This article demonstrates a Conditional Formatting formula that lets you highlight cells based on numerical ranges specified in an Excel […]

### Conditional formatting category

The image above demonstrates a conditional formatting formula that colors a record if there is at least one record that […]

This article explains how to count cells highlighted with Conditional Formatting (CF). The image above shows data in cell range […]

adam asks: Hi, I have a situation where I want to count if this value is duplicate and if it […]

Question: How do I highlight dates that meet criteria using conditional formatting? Table of contents Highlight values in a column […]

This post demonstrates how to highlight records with the closest value to a criterion, you can also choose to highlight […]

The image above shows rows highlighted based on value in column C being the largest or smallest in that particular […]

This article shows you how to easily identify duplicate rows or records in a list. What's on this webpage Conditional […]

The image above demonstrates a conditional formatting formula applied to an Excel Table containing random data. The Excel Table has […]

Question: I have a list that I keep adding rows to. How do i create a border that expands as […]

The image above shows you how to highlight rows with multiple criteria using OR logic. The criteria are found in […]

In this article, I will demonstrate how to search a table using conditional formatting. The criteria highlight matching column and […]

Today I am going to show you how to quickly compare two tables using Conditional Formatting (CF). I am going […]

The image above demonstrates a conditional formatting formula that highlights duplicate items based on date. The first instance is not highlighted, […]

A conditional formatting formula highlights values in column B that also exist in column D. =COUNTIF($D$3:$D$7,B3) The same thing happens […]

In this post I am going to try to explain formula basics in conditional formatting. It is really good if […]

The image above shows conditional formatting highlighting unique distinct values, duplicates are not highlighted. Conditional Formatting Formula: =COUNTIF($B$3:B3, B3)=1 The […]

This article demonstrates how to apply different cell formatting to a cell range based on a Drop Down list, column […]

In this blog post I will demonstrate a conditional formatting formula that will highlight common records in two lists. The […]

The image above demonstrates a conditional formatting formula that highlights records that only exist in one table. There are two […]

## Functions in this article

More than 1300 Excel formulas

## Conditional Formatting categories

## Excel categories

### 6 Responses to “Highlight every other row”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

This is helpful, thanks, but I've been looking for the formatting to take place AS I fill new cells.

So my scenario is: A clear-formatted excel sheet, and ONCE you insert data into each row, the color of the row changes, e.g. row 1 becomes light blue, row 2 becomes dark blue, BUT row 3 is still clear-formatted because I haven't inserted data in it yet.

Do you know how I can do that?

*Thanks!!!*

@Sawsan,

Select all the cells (starting from upper left corner of the range so the the upper left cell ends up the active cell) that you think you will ever need to put your alternating row colors in (I would refrain from selecting entire columns), then follow the blog's instructions to get to the Conditional Formatting dialog box and then use this formula...

=AND(ISEVEN(ROW()),COUNTIF($A1:$C1,"*")>0)

Change the range as indicated, but note that your formula should only specify the first row's cells range even though you will have many more rows selected.

@Sawsan,

I guess I missed your request for a second color. That will require a second condition for the second color... use the identical formula I gave you in my previous message for this condition, but change the ISEVEN function to ISODD.

hi,

i'm interested to know on the conditional formatting.

how do i set the condition to evaluate a dynamic range?

my example is this:

Rule: =MAX($G$5:$G$20)=$G5

Applied to: =$AG$5:$AG$20

based on the value in G5:G20, the rule will determine the max value and highlight it on AG5:AG20

If i add new rows of data to G21 onwards, the rules does not "extend" to the newly added rows.

david,

I got this working in excel 2007:

Rule: =MAX(OFFSET($G$5;0;0;COUNTA($G5:$G1000))=$G5

Applied to: =OFFSET($AG$5;0;0;COUNTA($G5:$G1000)

thanks oscar,

i was using a dynamic named range as the rule in conditional formatting.

will try ur solutions ;)

thanks!!!