Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Shading Rows with Conditional Formatting.

Shading Rows with Conditional Formatting

Written by Allen Wyatt (last updated July 8, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


4

If you haven't tried out the conditional formatting features of Excel before, they can be quite handy. One way to use this feature is to cause Excel to shade every other row in your data. This is great when your data uses a lot of columns and you want to make it a bit easier to read on printouts. Simply follow these steps:

  1. Select the data whose alternating rows you want to shade.
  2. Make sure the Home tab of the ribbon is displayed.
  3. Click the Conditional Formatting tool. Excel displays a series of choices.
  4. Click New Rule. Excel displays the New Formatting Rule dialog box.
  5. In the Select a Rule Type area at the top of the dialog box, choose Use a Formula to Determine Which Cells to Format. (See Figure 1.)
  6. Figure 1. The New Formatting Rule dialog box.

  7. In the formula space, enter the following formula:
  8. =MOD(ROW(),2)=0
    
  9. Click on the Format button. Excel displays the Format Cells dialog box.
  10. Make sure the Fill tab is selected. (See Figure 2.)
  11. Figure 2. The Fill tab of the Format Cells dialog box.

  12. Select the color you want used for the row shading.
  13. Click on OK to close the Format Cells dialog box.
  14. Click on OK to close the New Formatting Rule dialog box.

You may wonder why anyone would use conditional formatting to highlight different rows of a table when you can use the table formatting feature (available in the Styles group of the Home tab of the ribbon) to accomplish the same thing. The reason is simple—using conditional formatting provides much more flexibility in the formatting applied as well as in the interval of the rows being shaded.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7363) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Shading Rows with Conditional Formatting.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Splitting a Table

Table getting too long? Need to move part of a table to somewhere else in your document? You can easily split an existing ...

Discover More

Comments Only Visible When Hovering Over a Word or Phrase

The comment feature of Word allows you to easily attach comments to words or phrases in your document. How those comments ...

Discover More

Displaying Row and Column Labels

When you create a worksheet, it is common to place headings at the top of each column and the left of each row so you can ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Highlighting Cells Containing both Letters and Numbers

Conditional formatting is a great tool for changing the format of cells based on whether certain conditions (rules) are ...

Discover More

Comparing Dollar Values in a Conditional Formatting Rule

Comparing values (like is done in conditional formatting rules) can yield some crazy results at times. This tip looks at ...

Discover More

Changing Font Face and Size Conditionally

Conditional formatting does not allow you to change the typeface and font size used in a cell. You can write your own ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 7?

2023-07-11 03:56:45

Enno

OK. I thought, that "shading" is a sort of darker line around the cells.
Yes, I am old enough to remember these papers.


2023-07-10 06:09:00

Steve Jez

Enno,
IMO there is no real difference, shading is generally used to identify rows that are coloured to assist "reading" data, where the data extends across a number of columns. Generally a lighter colour is used in these situations so as not to be too distracting.
If you're old enough, think of the green & white fan fold printer paper of the 80's used in the dot matrix printers.


2023-07-10 02:31:19

Enno

Can you tell me, what the difference is between "to fill" and "to shade".?
I used the description here and got cells, that are completely filled with the used color. Where ist the "shade"?

EPG


2023-07-08 05:01:31

Steve Jez

If you just need to shade alternate rows then you could use
=ISEVEN(ROW()) or =ISODD(ROW())
you can then use whichever suits your first shaded row.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.