Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Ignoring Selected Words when Sorting.

Ignoring Selected Words when Sorting

Written by Allen Wyatt (last updated June 4, 2022)
This tip applies to Excel 2007, 2010, 2013, and 2016


Arn has a need to exclude certain words when sorting a column. For instance, he is trying to exclude "The" when sorting a list of movie titles, so that "Alpha, Charlie, The Bravo" would sort as "Alpha, The Bravo, Charlie."

There is no built-in way to do this. The best solution is to set up an intermediate column for your data. This column can contain the modified movie titles, and you can sort by the contents of the column. For instance, if column A contains your original movie titles, you could fill column B with formulas, such as this:

=IF(LEFT(A1,4)="The ",MID(A1,5,LEN(A1)-4),A1)

This formula will strip the word "The" (with its trailing space) from the start of the line. If you want to add the word "The" at the end of the string, then you could modify the formula in the following manner:

=IF(LEFT(A1,4)="The ",MID(A1,5,50),A1) & ", The"

If you wanted to delete all instances of the word "the" without regard to where it appeared in the title, you could use the following instead:

=SUBSTITUTE(A1,"the ","")

Sorting, again, would be done by the results shown in column B. This will give the list in the desired order.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11976) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Ignoring Selected Words when Sorting.

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

Setting a Spacing Adjustment in the Equation Editor

The Equation Editor is a handy tool when you are creating documents that rely on mathematical formulas. If you want to ...

Discover More

Adding a Background to Your Document

Document backgrounds come in handy if you plan on converting the document to a Web page. Here's how you can add a ...

Discover More

Deleting Conditional Formatting

After you've applied a conditional format to a cell, you may have a need to later delete that format so that the cell is ...

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)

Sorting an Entire List

Need to sort all the data in a table? Here's the fastest and easiest way to do it.

Discover More

Recognizing a Header Row when Sorting

When you sort data in a worksheet, there are a couple ways you can do it. Using the simple way can result in ...

Discover More

Sorting IP Addresses

If you keep track of IP addresses in an Excel worksheet, you probably already know that it is difficult to sort those ...

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 two less than 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.