Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. 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: Sorting a Text Selection.

Sorting a Text Selection

by Allen Wyatt
(last updated July 4, 2015)

12

As you use Word, there will be numerous times when you need to rearrange lists of items. Word provides a sorting tool that makes rearranging lists easy. To sort a selection of text, follow these steps:

  1. Select the text containing the list to be sorted. Make sure only the list is selected.
  2. In the Home tab of the ribbon look in the Paragraph group. When you click on the Sort tool, Word will display the Sort Text dialog box. (See Figure 1.)
  3. Figure 1. The Sort Text dialog box.

  4. In the Sort Type drop-down list, select the type of sorting you want Word to perform. For instance, if the first information in your text list represents a date, you would choose Date as the Sort Type.
  5. Using the radio buttons, indicate whether the sort should be Ascending or Descending.
  6. Click on OK.

The Sorting function in Word is rather basic. If you need to do more advanced sorting consider copying your data into Excel or pasting an Excel spreadsheet object into your Word document.

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

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

Changing Paragraph Order

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

Discover More

AutoFilling with the Alphabet

If you need to fill a number of cells with a specific sequence of characters (such as the alphabet), there are several ways ...

Discover More

Setting Default Attributes for Lines and Arrows

Don't like the way that Excel formats lines and arrows? You can easily make your own formatting changes, and then use your ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Sorting Single-Column Addresses

Got a document that contains a bunch of addresses? If you want to sort the addresses, then you are in for a surprise because ...

Discover More

Sorting Text

Word makes it easy to sort the information that is contained in your document. Here's how to accomplish this.

Discover More

Changing Sort Order

When sorting information, Word follows some pretty strict rules. If you want to modify how those rules are applied, you may ...

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}] 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 7 - 1?

2016-03-22 10:09:01

richard tessier

Larry & Ken
You're both welcome.
I've been dealing with very large files in different languages, and discovered that no matter what kind of sorting I needed, I could do it with Word. There's just no limit to what you can do with it if you just think hard enough about it.


2016-03-21 18:51:34

Larry Lawson

Richard Tessier - that method works perfectly and it is so simple. Thanks so very much. Getting this to work is a big deal for me. - Larry

Ken Endacott - thanks for explaining how to run a macro, as I have never done one before. - Larry


2016-03-19 06:11:56

Ken Endacott

Richard

Your method works beautifully, much simpler than my macro.


2016-03-18 16:27:41

richard tessier

Larry,
Ken Endacott's macro seems to be a fairly complex one.

You can sort your paragraphs with a simple search and replace.

Simply place a unique symbol (vertical bar | or other) in front of your sort word. This creates a new field in each paragraph.

Then on the Sort Options menu, select Options, Separate Fields at, Other, and type your | symbol there.

Sort on Field 2. All paragraphs in which your sort word appears will be listed together at the end of your document.

Then simply do another search and replace to delete the unwanted | symbol.


2016-03-18 06:30:26

Ken Endacott

There are several ways to run a macro. In your case I suggest the following method which is useful when you are developing or testing a macro or you need to run a macro once only. Later if desired, the macro can be put into a template or added to a toolbar.

1. Open a new blank document and save as MyMacros.docm
2. Open the Visual Basic editor by pressing ALT/F11
3. Select Project (MyMacros) then click the menu item Insert/Module. This will create a module called Module 1
4. Click Module 1 and copy the macro into the code window
5. Open the document that you want the macro to operate on. Make sure that you have a backup.
6. Minimise the MyMacros document but leave the other document visible
7. Go to the Visual Basic editor, select Module 1 and place the cursor inside the macro you want to run.
8. Click F5 to run the macro. You can also click F8 to step through the macro line by line.

The macro can be edited and run again. For example to specify a group of words to search for, change the statement searchText = "Mytext" to searchText = "Several words". If you want to specify any case then set .MatchCase = False

You can use the MyMacros.docm document to hold other useful macros that you might come across.


2016-03-17 15:45:22

Larry Lawson

Ken Endacott - thanks very much for this macro to use for trying to collect all paragraphs by a keyword, but I can't figure out how to copy and paste it into Word 2010/View/Macros. It keeps waiting for me to "Record" the macro.


2016-03-16 09:08:06

richard tessier

Larry,
There are two ways.

1. Copy the word as if it were a title on a line above each paragraph, followed by a manual line break (not a paragraph mark, otherwise you will create a new paragraph for that word.

2. Insert either a tab (or another character, for example a vertical line (|) in front of the word. This will create a field on which you can sort. The beauty of this is that the word does not even have to be on the first line of each paragraph.


2016-03-16 09:05:58

Ken Endacott

The following macro will collect all paragraphs containing the word Mytext and place them at the end of the document.

Sub CollectParagraphs()
Dim aRange As Range
Dim np As Long
Dim p As Range
Dim i As Long
Dim searchText As String
searchText = "Mytext"
np = ActiveDocument.Paragraphs.Count
i = 1
Do While i < np
Set p = ActiveDocument.Paragraphs(i).Range
With p.Find
.ClearFormatting
.Text = searchText
.Wrap = wdFindStop
.MatchCase = True
End With
If p.Find.Execute(Replace:=wdReplaceNone) Then
Set aRange = ActiveDocument.Range
aRange.Start = aRange.End
Set p = ActiveDocument.Paragraphs(i).Range
aRange.Text = p.Text
p.Delete
np = np - 1
Else
i = i + 1
End If
Loop
End Sub


2016-03-15 16:27:20

Larry Lawson

I have created a document with 1600 paragraphs. I want to collect (gather together) all of the paragraphs with a specific word in it. How to do this?

- Thanks


2015-11-15 13:05:21

John Herbster

Using Word 2013, I would like to sort a log where each paragraph begins with a mm/dd/yyyy<tab><log entry>
There is a header (paragraph) line with "Date"<tab>"Entry" (w/o the quote marks). I can select the "Header" button; but, it only sometimes sees the Entry field. I hate these "works sometimes" computer tools. I suppose that I should look for or write a custom Log Editor program. --JohnH


2015-09-12 17:23:05

Jackolyn

Is there a way to sort a directory of folders into chronological month order? For example, I save my newsletters by month in a folder called Newsletters. In that folder I have sub-folders of all the months. The order comes out in alphabetical order; I would like them to be listed by month - January, February, March, etc., rather than April, August, etc. Is there a way to do this?


2015-07-05 09:25:07

richard tessier

Sorting in Word is actually not so basic, given that you can actually sort on more complex algorithms than in Excel.

Just one example : in Word, the item (word, number, etc.) on which you want to sort does not have to be the first word in the field (s.th. you can do in Excel) or even on the first line of your sort field (s.th. you can't do in Excel). Symply use a symbol other than a tab to define your fields, and end all your lines except the last one by a manual end-of-line mark (not by a paragraph mark). You can then sort on the field or fields defined by that symbol, even if they are not on the first line of your multiple-line paragraph. I don't think you can do that in Excel and if you're dealing with text, it's much easier to handle in Word than in Excel.


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.

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