Microsoft KB Archive/83335

{|
 * width="100%"|

WinWord: Correct and Incorrect Formats for Sorting Dates

 * }

Q83335

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c

-

SUMMARY
In Microsoft Word versions 1.x and 2.0x for Windows, dates in some formats cannot be sorted and some date formats must be sorted using a tab as a separator. Some date formats can be sorted correctly regardless of the separator.

MORE INFORMATION
In Word version 6.0 for Windows, all date formats sort correctly except for dates that are expressed as only a month or an abbreviation of a month (for example, November, December, Nov, and Dec). Sorting in Word 6.0 works for all formats except stand-alone dates, regardless of which separator is chosen.

In Word versions 1.x and 2.x for Windows, the following formats do not sort correctly in all situations:


 * Month names or abbreviations by themselves (for example, October or Oct)
 * Month abbreviations with periods in the date (for example, Oct. 2, 1993)

In Word versions 1.x and 2.x for Windows, certain date formats require the separator to be a tab (set in the Tools Sorting dialog box). If the separator is a comma, dates in the following format sort in chronological order based on the day of the month; they do not use the month and year as part of the sorting criteria. It does not matter whether or not the data is in a table or in tabular columns.

The following are formats in Word versions 1.x and 2.x for Windows that require a tab as a separator during sorting:


 * Month name written out in full plus date, comma, and year (September 23, 1993)
 * Month name written out with abbreviated name but no period for date, comma, and year (Sept 23, 1993)

The following formats sort correctly, regardless of the separator selected in the Tools Sorting dialog box:

  Date Format           Example ---          ---

MMM-yy               Jan-92 M/d/yy               1/23/92 M-d-yy               1-23-92 d-MMM-yy             23-Jan-92 M/d/yy h:mm AM/PM    1/23/92 3:30 PM To ensure proper sorting, use the correct symbol to separate day, month, year, and time references (as indicated in the table above). For example, using spaces instead of hyphens to separate some date formats will not work correctly. You must also select Date as the key type by which to sort in the Tools Sorting dialog box.

Sorting Stand-alone Months
There is no workaround for sorting standalone months, other than changing the month name to the representative number (for example, change December to 12).

Date with Abbreviated Month, Period, Date, Year
To work around a date with an abbreviated month followed by a period, date, and year (for example, Oct. 6, 1994):


 * 1) Select the text or column containing the dates to sort.
 * 2) From the Edit menu, choose Replace.
 * 3) Replace the period with a space.
 * 4) From the Tools menu, choose Sorting.
 * 5) In the Key Type box, select Date. For Separator, select Tab. If your text is in a table, you must first select some text or paragraph marks outside of the table, then change the separator to a tab. When the insertion point is inside a table, the separator is unavailable (dimmed) and cannot be changed. Once you've changed the separator, select the text to sort or select the appropriate field number.
 * 6) Perform the sort.
 * 7) To restore the periods in the abbreviations, you can replace two spaces in the selection with a period and a space, providing the two spaces occur together only in the dates.

Date with Abbreviated Month, No Period, Date, Year
To work around a date with an abbreviated month, followed by no period, date, and year (for example, Sep 23, 1993):


 * 1) From the Tools menu, choose Sorting.
 * 2) In the Key Type box, select Date. After Separator, select Tab.

If your text is in a table, you must first select some text or paragraph marks outside of the table, then change the separator to a tab. When the insertion point is inside a table, the separator is unavailable (dimmed) and cannot be changed. Once you've changed the separator, then select the text to sort or select the appropriate field number.
 * 1) Perform the sort.

Date with Month Written Out, Day, and Year
To work around a date with month written out, followed by the day and year (for example, September 23, 1993):


 * Use the previous procedure for abbreviated month with no period, day, and year.
 * Use Microsoft Graph to get the dates into a sortable format. To do so:


 * Select the dates to be sorted.
 * From the Edit menu, choose Copy.
 * Run MS Graph.
 * Make the datasheet active and place cursor in the top left cell.
 * From the Edit menu, choose Paste. The text will paste in the d-MMM-yy format (for example, 23-Sep-92).
 * Select the text and choose Copy from the Edit menu.
 * Close MS Graph. Do not update the document, and leave original text still highlighted.
 * From the Edit menu, choose Paste. The date is now in a format that can be sorted regardless of the separator.

NOTE: On page 299 of the version 2.0 &quot;Microsoft Word for Windows User's Guide,&quot; the documentation incorrectly states that Word will sort the &quot;MMMM d, yyyy&quot; date format correctly. This format is also incorrectly listed as a proper sorting format on page 662 of the &quot;Word for Windows Companion,&quot; by Mark W. Crane.

Both references contain documentation errors. Word can sort dates in this format (for example, September 23, 1994) correctly only if you choose Tab as the separator in the Sorting dialog box.