Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Controlling How Word Sorts Text.

Controlling How Word Sorts Text

Written by Allen Wyatt (last updated June 26, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


2

If you want to sort a column of words, you always need to deal with Word's very literal way of sorting information, such that punctuation marks sort first, then numbers, then A, B, C, and so on. So, if you put the word "zebra" in quote marks, Word will sort it before words that start with the letter A. In most instances it would be nice if Word could ignore the quote marks and sort zebra in its regular place, with other words beginning with the letter Z.

There is no way to configure Word to do sorting in the way you want, but you can—with a little ingenuity—create a workaround that will get things sorted just as you want them. The basic idea is to use hidden text to place, at the beginning of your word, text that indicates how you want the word actually sorted. Thus, in the case of zebra, you would follow these steps:

  1. Type "zebra", with the quote marks, as you normally would.
  2. Position the insertion point just before the opening quote mark.
  3. Type the word zebra without quote marks. The text should now look like this: zebra"zebra".
  4. Select the unquoted text you typed in step 3.
  5. Press Ctrl+Shift+H.

What happens at this point depends on whether you have hidden text visible within your document. If it is visible, then a dotted underline appears beneath the selected text. If hidden text is not visible, then the word you had selected seems to disappear. (It is still there; it is just hidden.)

The idea from this point is to turn off the display of hidden text when you are ready to print or read your document. Here's how to hide the hidden text so it is not displayed:

  1. Display the Word Options dialog box. (In Word 2007 click the Office button and then click Word Options. In Word 2010 or a later version display the File tab of the ribbon and then click Options.)
  2. At the left side of the dialog box click Display. (See Figure 1.)
  3. Figure 1. The Display options of the Word Options dialog box.

  4. Make sure the Hidden Text check box is cleared.
  5. Click OK.

When you are ready to sort, display the hidden text (same method as hiding it, but make sure the check box is selected in step 3) and then do your sort. The sorting then takes the hidden text into account, and your list is sorted as you desire.

This approach of embedding hidden "keywords" into your list is also helpful in those instances where you have a limited number of entries that begin with numbers. For instance, if you have a list entry such as "3 horses" (without the quotes), you may want it sorted as if it were "three horses." Just use the hidden-text method to embed the desired sorting keyword (three horses) at the beginning of the entry.

You can also use this method to force Word to ignore prepositions or conjunctions when doing sorting. For instance, you might want "A Midsummer Night's Dream" to be sorted as if it were "Midsummer Night's Dream." Just embed the desired hidden text at the beginning of the entry, and then use it to do your sorting.

If, at some future time, you actually want to get rid of the hidden-text keywords, you can do so by using Word's Find and Replace feature. Word allows you to search for formatting, including the Hidden attribute, which you can replace with nothing. (How to do such Find and Replace operations has been covered in other issues of WordTips.)

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (7357) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Controlling How Word Sorts Text.

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

Comment Dates Updated Inappropriately

Using the comment capabilities of Word is a common occurrence when developing a document. What do you do, however, if the ...

Discover More

Adding a Printer

One of the most common output devices used with computers is a printer. This tip explains, in detail, how you can set up ...

Discover More

Aligning Digits in a Table

Placing information in your table is only half the battle. You also need to figure out the best ways to format that ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (ribbon)

Odd Sorting

Word is great at sorting simple information in tables and paragraphs. If you have more complex information (such as ...

Discover More

Sorting by Highlighting

The sorting capabilities of Word are quite handy and easy to use. What if you want to sort by something Word doesn't sort ...

Discover More

Changing Paragraph Order

Want a quick way to rearrange entire paragraphs of your document? You can easily do it by using the techniques described ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, 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 eight more than 3?

2021-02-24 14:38:42

Markinboone

Frequently, I need to be sure reference lists are sorted according to APA Style. Without getting into the details of APA Style, here's how Word sorts the entries (2020 comes before Ed.; & comes before Barns):
Abbot, A. B. (2020). A book title. Publisher.
Abbot, A. B. (Ed.). (2019). A book title. Publisher.
Abbot, A. B., & Zoolander, A. A. (2010). A book title. Publisher.
Abbot, A. B., Barns, B. C., & Zoolander, A. A. (2012). A book title. Publisher.

And here's how the list should be sorted (by name, then multiple names, then date, then work title), ignoring ampersands between names and editor designations:
Abbot, A. B. (Ed.). (2019). A book title. Publisher.
Abbot, A. B. (2020). A book title. Publisher.
Abbot, A. B., Barns, B. C., & Zoolander, A. A. (2012). A book title. Publisher.
Abbot, A. B., & Zoolander, A. A. (2010). A book title. Publisher.

Since these elements need to be ignored entirely (not just sorted differently) my solution was to write (Record) a macro that did these steps after turning off Show Hidden Characters and selecting the paragraphs to sort:
Find: &[space] Replace With: &[space] < format Font to Hidden
Find: (Ed.).[space] Replace With: (Ed.).[space] < format Font to Hidden
Find: (Eds.).[space] Replace With: (Eds.).[space] < format Font to Hidden (not in example)
Sort the selection: Paragraph | Text
Set Font property for all to Not Hidden

I had to tweak the macro to remove specifics I didn't want to affect the results, like this line in the Find parameters:
Selection.Find.Replacement.Style = ActiveDocument.Styles("")
and in the section that set all text to Not Hidden, I had to delete all the other Font properties that were recorded.


2019-03-09 08:51:40

Gerry Richardson

Dear Allen,
Just can't thank you enough for all your Word and Excel Tips. I work through them every morning. It's a great way to learn so many of the features of these programs. I know I've told you this before....but I am so very grateful. Gerry R.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, 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.