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


Double-Clicking to Widen Columns Won't Work

One way you can widen the columns in a worksheet to fit whatever is in the column is by double-clicking the right edge of the ...

Discover More

Special Characters in Fields

If you try to add a quote mark or a backslash as part of a field parameter or switch, you may be surprised at what you ...

Discover More

Including Text Box Text in Word Counts

If you use text boxes in the layout of your documents, you should know that any word counts you perform do not include any ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!


Deleting Unwanted Styles

Custom styles can be a great help in formatting a worksheet. You may, at some point, want to get rid of all the custom styles ...

Discover More

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

Formatted Dates Appear Differently on Different Systems

When you format a date in a specific manner, you may be surprised to see that the format changes when you open the workbook ...

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.

Comments for this tip:

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. 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 minus 6?

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!

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.

Links and Sharing