Differentiating a Header Row

by Allen Wyatt
(last updated November 27, 2017)


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, and 2013.

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


Determining the Length of a Non-Document Text File

If you use a macro to create and work with text files, you can find out the length of those files using a simple command. ...

Discover More

Jumping To a Comment

Got a document with lots of comments in it? You can navigate from comment to comment with ease by using the Go To tab of ...

Discover More

Printout Doesn't Match Display for Some Cells

Have you ever noticed that when you print something, there are times that what is printed doesn't exactly match what you ...

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)

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

Changing Currency Formatting for a Single Workbook

Currency is formatted differently in different corners of the world. Most formatting uses periods and commas to indicate ...

Discover More

Applying Table Formats

Want to format your data tables in a hurry? It's easy to do if you use the built-in table formatter provided in Excel.

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 seven more than 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.