Microsoft KB Archive/212116

= WD2000: Sort Order Appears Incorrect in a List or Menu =

Article ID: 212116

Article Last Modified on 12/6/2000

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q212116





SYMPTOMS
Microsoft Word appears to sort items in the wrong order. Any list that contains both numbers and text in the entries may appear to be sorted incorrectly. This includes menu listings for bookmarks, macros, or AutoText entries.

For example, if you have three bookmarks named Test1, Test2, and Test11, they appear in the Bookmark Name list in the following order:

Test1

Test11

Test2



CAUSE
Word sorts mixed numbers and text in the same way that it sorts text, that is, one character at a time. For example, Word places all numbers that begin with 1 (such as 12, 156, or 1147) before all numbers that begin with 2 (such as 22, 256, or 2276). If two or more items begin with the same character, Word evaluates subsequent characters in each item to determine which item should come first. For example, Word places 124 before 19, based on the second digit (2 is less than 9, so 124 comes before 19).

When you are manually sorting lists, if there is no text selected with the numbers and you select Number as the Type (on the Table menu, click Sort, and then view the Sort Text dialog box), the numbers are sorted in correct numeric order without padding (leading zeros).



WORKAROUND
If you have named items that appear on a menu and which include numbers and text, you can change (pad) each name to include leading 0 (zeros) with the number, so that all the numbers have the same number of characters. If a list looks like Test1, Test2, and Test11, change the items to Test01, Test02, and Test11. Word now sorts them in the expected order.

When you are manually sorting lists, if the text follows the numbers (as in 19Test 2Test 124Another), Word sorts the numbers correctly and totally ignores the text, if you select Number as the Type in the Sort Text dialog box (on the Table menu, click Sort). However, if the numbers are padded with zeros and the list sorted as text, both the numbers and text are sorted as expected.

Keywords: kbprb KB212116

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.