Three tricks for formatting rows in Excel

By David H. Ringstrom, CPA

I'm sure that you've worked with data sets in Excel where the information starts blurring together. In this article I discuss several techniques that I use avoid getting lost in the forest. First I'll briefly describe the Table feature in Excel 2007 and Excel 2010, and then share some conditional formatting tricks for anyone that's still using an earlier version of Excel.
It's easy to change the color of every other row in an Excel 2007 or Excel 2010 worksheet:
1.     Select a single cell within your list of data.
 
2.     Choose Format as Table from the Styles section of the Home ribbon, and then choose a color scheme, as shown in Figure 1.
 
3.     As shown in Figure 2, Excel will automatically determine the cell coordinates of your table. If you choose the My Table Has Headers option, then Excel will add Filter arrows at the top. As an added bonus, if your table is longer than what you can see on a single screen, your header row contents will move into the worksheet frame when you scroll down, as shown in Figure 3.
 
4.     To eliminate the table, choose Convert to Range in the Tools section of the Design tab that appears when you click on the table. The formatting remains in place, so to eliminate it you can either choose new formatting, or use the Clear Formatting command in the Editing section of the Home ribbon.
 
 
Figure 1: Excel 2007's Format as Table feature.
 
 
Figure 2: Excel automatically determines the cell coordinates of your table.
 
 
Figure 3: Your header row appears in the worksheet frame when you scroll beyond the first screen.
The Table feature is a fast way to format your data, but let's say that you need more control over your formatting, such highlighting your data in groups of 5. You can use the Conditional Formatting feature in Excel 2007 or 2010 to do so:
1.     Select the cells that you wish to format.
 
2.     Click the Conditional Formatting button in the Styles section of the Home ribbon, and then choose New Rule, as shown in Figure 4
 
 
Figure 4: Conditional Formatting appears on the Home tab of the ribbon.
 
 
3.     Select Use a Formula to Determine Which Cells to Format, and then enter this formula:
 
4.     Click the Format button to assign the formatting of your choice, and then click OK.
=MOD(CEILING(ROW(),5),2)=0
5.     As shown in Figure 5, alternating blocks of 5 rows will be highlighted.
 
 
Figure 5: Conditional formatting allows us to highlight data in blocks of 5 rows at a time.
 
 
Note: Use this formula with Conditional Formatting if you wish to highlight every other row:
=MOD(ROW(),2)
In Excel 2003 or earlier, select the cells you wish to highlight, choose Format, and then Conditional Formatting. Change Condition 1 to Formula is and use one of the formulas shown above.
Here's a quick rundown of how these formulas work:
·         ROW returns the current row number. This function allows you to optionally specify an address argument. However, in this case we're referring to the current row, so there's no need to provide a cell address.
 
·         CEILING rounds the row number up to the next multiple of 5 (or whatever number you specify). There are two arguments: number, and significance. We use ROW() to provide the number, and significance is the multiple that we want to round the row number to.
 
·         MOD returns the remainder from a division calculation, and has two arguments: number and divisor. In the case of the first formula, the results of the CEILING function are divided by 2. This means that rows 1 through 5 would round up to 5, and since 2 does not divide evenly into 5, MOD returns 1. Since we added =0 to the end of our formula, the Conditional Formatting feature in turn formats rows where MOD returns 0 instead of 1. Thus rows 1 through 5 don't get formatted, while 6 through 10 do, while 11 through 15 don't, and so on.
 
About the author:
David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at david@acctadv.com or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link.

 

You may like these other stories...

Event Date: May 29, 2014 In this presentation Excel expert David Ringstrom, CPA brings you up to speed on the Excel feature you should be using, but probably aren't. The Table feature offers the ability to both...
No field likes its buzzwords more than technology, and one of today's leading terms is "the cloud." But it's not just a matter of knowing what's fashionable. Accounting professionals who know how to use...
There is a growing trend of accountants moving away from traditional compliance work to more advisory work. Client demand is there, but it is up to the accountants to capitalize on that. What should accountants' roles be...

Upcoming CPE Webinars

Apr 17
In this exciting presentation Excel expert David H. Ringstrom, CPA shares tricks that you can use with pivot tables every day. Remember, either you work Excel, or it works you!
Apr 22
Is everyone at your organization meeting your client service expectations? Let client service expert, Kristen Rampe, CPA help you establish a reputation of top-tier service in every facet of your firm during this one hour webinar.
Apr 24
In this session Excel expert David Ringstrom, CPA introduces you to a powerful but underutilized macro feature in Excel.
Apr 25
This material focuses on the principles of accounting for non-profit organizations' revenues. It will include discussions of revenue recognition for cash and non-cash contributions as well as other revenues commonly received by non-profit organizations.