Written by Allen Wyatt (last updated December 29, 2018)
This tip applies to Excel 97, 2000, 2002, and 2003
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 (3892) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Ignoring Selected Words when Sorting.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Want to sort addresses by even and odd numbers? By using a formula and doing a little sorting, Excel can return the ...
Discover MoreInformation in a cell can be entered using line feeds, which results in multiple lines of data in the same cell. If you ...
Discover MoreWhen you think of sorting Excel data, it is likely that you think of sorting rows. Excel also allows you to sort by ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-02-11 10:02:20
Sir Owns
Would love to be able to ignore "The" in a sort without stripping it.
2019-01-16 03:42:52
Jeff
=IF(LEFT(A1,4)="The ",MID(A1,5,50),A1) & ", The"
Adds the word "The" to everything.
Should be
=IF(LEFT(A1,4)="The ",MID(A1,5,50) & ", The", A1)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments