Differentiating a Header Row

by Allen Wyatt
(last updated June 8, 2018)


Josiah knows that formatting changes to the first row of a list automatically clues Excel to the fact that the row is a header row so it won't be included in sorting. He wonders, though, what exactly Excel looks for when it determines that the first row of data is a header row. For example, just making the first row bold does not seem to be enough, so he wonders what it really takes.

Microsoft has not published the algorithm it uses to make this determination, but one can intuit the formatting differences that are necessary. A good indicator seems to be if the data in the first row is different than the data in subsequent rows. For instance, if a column contains dates, times, or numbers (and are formatted as dates, times, or numeric formats), but the first cell in the column contains text (and aren't formatted as a date, time, or number), then Excel can hazard a guess that the first row contains headers.

Another flag for Excel seems to be if your header row has borders turned on, whereas the rest of your cells do not. (I make it a point to always make the first row bold with a bottom border, and this seems to do the trick every time.)

You should note, however, that Excel doesn't do well with multi-row headers or blank cells in a single-row header. It only really recognizes, automatically, a single header row. If you have a multi-row header, select the data you want sorted before you sort it. If your header row contains blank cells, then Excel (for some reason) interprets the row as part of your data. Again, you'll want to select the actual rows to be sorted before actually sorting.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3828) applies to Microsoft Excel 2007, 2010, 2013, and 2016.

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. ...


Using the Organizer to Manage Macros

There may come a time when you want to copy or rename macros. You can do this quite easily by using the Organizer tool ...

Discover More

Quickly Switching Between Spreadsheet Windows

Using the keyboard to switch between Excel spreadsheets.

Discover More

Determining a State from an Area Code

Want to be able to take information that is in one cell and match it to data that is contained in a table within a ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Losing Formatting

When you save a workbook, you expect Excel to remember the formatting you applied in the worksheets in that workbook. If ...

Discover More

Hash Marks Displayed Instead of Cell Contents

Have you ever entered information in a cell only for it to appear as hash marks? This tip explains why this happens, how ...

Discover More

Setting Vertical Alignment

Excel allows you to adjust not only the horizontal alignment of values in a cell, but also the vertical alignment. This ...

Discover More

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

View most recent newsletter.


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}] 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 5 + 2?

2016-01-05 11:29:12

Gary Lundblad

I seem to have problems if I delete columns, although not always. Usually I sort a range of data, and it recognizes the header rows correctly, but then I delete a column, select the same range, select sort, and it no longer recognizes the header row. What happened, and how can I get it to recognize it again?

I have tried making the text bold, italics, underlined, shaded, with a bottom border, and it still doesn't see it. Help!

Thank you!


2015-12-29 12:13:03


Often when I try to apply auto-filtering to a table with multiple headers by clicking a single cell in the table and choosing filter, it erroneously chooses the wrong headers. I get around this by selecting just the data I want to filter (including the desired header row) and then it knows which headers get the filter dropdowns.

2015-12-29 08:03:47

Barry Clermont

Great tip. I would suggest making sure you use a single row if you ever want to apply a pivot table or pull into Access.

2013-06-17 09:29:07

David Staudenmeir

I've personally never found the "my data contains headers" box unchecked by default, and so have never had to apply any kind of first row formatting, other than what I might normally do anyway, with the thought of applying that just to trigger the "header row" criteria.

2013-06-16 09:04:12


For me, the box always comes up so I simply confirm that "Yes, my data contains header rows".

2013-06-15 12:51:50


Some of the dialog boxes for commands that operate on data ranges (such as Sort and Create Table) have a "My data contains headers" checkbox that you can turn on if Excel doesn't recognize the header row. But it's better to apply the formatting, as discussed in the tip, so you never have to remember to check the box!

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

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.