Differentiating a Header Row

Written by Allen Wyatt (last updated December 30, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

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, 2016, 2019, Excel in Microsoft 365, and 2021.

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

MORE FROM ALLEN

Determining Word Frequency

How to construct a word frequency list.

Discover More

Differences between SEQ and LISTNUM Fields

Word provides several different fields you can use for custom numbering in a document. Two of the most commonly used are ...

Discover More

Checking for Text

Need to figure out if a particular cell contains text? You can use the ISTEXT function to easily return this bit of trivia.

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!

More ExcelTips (ribbon)

Problems with Custom Views

If you get an error when you try to use one of your custom views, it could be due to the protection you have applied to ...

Discover More

Setting Cell Width and Height Using the Keyboard

Hate to take your hands off the keyboard? Here are a couple of ways you can reject the mouse and still adjust the height ...

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
Subscribe

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

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}] (all 7 characters, in the sequence shown) 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 2 + 8?

2024-02-02 05:03:03

Michael van der Riet

Thank you. This is a frequent source of Ouch and adopting slightly different habits as you suggest, will prevent future problems.


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
Subscribe

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.