Differentiating a Header Row

by Allen Wyatt
(last updated December 29, 2015)


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


Word Mail Merge Magic

The mail merge tool available in Word is powerful, allowing you to use data from a variety of sources to create hundreds or ...

Discover More

Copying Fill Color in a Table

You may spend some time getting the color in a portion of a table just right, only to be faced with the task of copying that ...

Discover More

Adding Quoted Words to an Index

It is not unusual to need to convert one notation in a document into another entirely different notation. For instance, you ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

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

Understanding Underlines

Excel provides a variety of underlining styles you can use when you need to underline information within a cell. Here's what ...

Discover More

Changing the Percent Symbol

Some symbols can be easily changed in Excel or in Windows, such as the symbols used for currency and to separate thousands in ...

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