Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. 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: Use Filenames That Sort Properly.

Use Filenames that Sort Properly

Written by Allen Wyatt (last updated April 20, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


3

It is not uncommon to work on projects that require several documents. For instance, you may be working on a manual that has several parts. When you are naming files for this project, you should use names that will later sort properly when you use various functions of Word.

For instance, when you choose to open a document, you see the standard Open dialog box that shows the files in the current directory. If your files are named properly, they will always appear in order on the list. I ensure this by starting all files related to a project with two digits that represent the order in which the document appears in the project. For instance, if the project entails an introduction, three sections, and an appendix, then the files may be named as follows:

01 Introduction.docx
02 Section 01.docx
03 Section 02.docx
04 Section 03.docx
05 Appendix.docx

Without the leading two digits, of course, the files would be displayed in the dialog box in an entirely different order. For me, the above approach ensures that the files are always in the logical order I need. The only drawback is that if I need to add a new section (such as Section 04), then I need to change the number of the 05 Appendix.docx file to 06 Appendix.docx so that the new section can become 05 Section 04.docx. This renaming is a small price to pay to keep my files in the desired order.

One way around the renaming issue is to change the way you do the digits at the first of the filenames. You could, for instance, increment the numbers by tens, such as this:

10 Introduction.docx
20 Section 01.docx
30 Section 02.docx
40 Section 03.docx
50 Appendix.docx

Now you can "insert" files in the sequence by simply using a number that indicates where you want it to occur. For instance, if you wanted to add a file between the one starting with "20" and the one starting with "30," you could just start that file with "21" or "25."

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10840) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Word here: Use Filenames That Sort Properly.

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

Searching for Non-Black Text

Searching for text having (or not having) specific formatting is generally pretty easy. It is more difficult to search ...

Discover More

Resetting Default Character Formatting

If you need to remove any explicit character formatting from some text, you'll want to commit the shortcut in this tip to ...

Discover More

Stopping Worksheets from being Reprotected

Securing worksheets and workbooks is a big concern for many people. If you password-protect a worksheet, you expect that ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Saving in a Macro Using a Desired File Name

Need to save a new document, from within a macro, to a specific file name? If you use the Record Macro capabilities of ...

Discover More

Cannot Open Multiple Word Documents

What are you to do if you try to open a document and Word automatically closes your previous document? Word is not ...

Discover More

Determining If a File Exists

Your macro may need to know if a particular file exists. This is easy to figure out using the Dir command, and even ...

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 2 + 2?

2024-04-23 13:52:03

Kathy R.

Along those same lines... I create a weekly bulletin. If you name it "Jan 2 2024" or "1-2-24 bulletin," In these cases April will come before January, or January will be followed by October, November, and December, before February (1, 10, 11, 12, 2).

I use the yymmdd format (240102 bulletin) which makes it very easy to sort by date.

Kathy R.


2024-04-22 11:41:40

Paul Stregevsky

Thanks, Steve Wells, for sharing your findings. Who knew that Name 1.txt would sort before Name.txt?

Allen, thanks for your brilliant tip on using "decade numbering" (10, 20, ... 90) to accommodate unplanned insertions (10, 11, 12, 20, 30...).


2024-04-20 22:15:29

Steve Wells

I wanted to mention a few details about the way Microsoft Windows sorts filenames and some ways to place names so they appear after alphabetic names. I discovered many interesting details that were not readily available on the internet, even with some searching. The following is my resulting "treatise," but I can't seem to type tabs here, so sorry if things don't line up well.

Character names below use terminology of the Character Map applet. Colloquial terms may follow. I've thrown in a bunch of Unicode characters that might make visually appealing prefix characters.

The following keyboard characters cannot be used in file names
\ U+005C Reverse Solidus (Backslash)
/ U+002E Solidus (Forward Slash)
: U+003A Colon
* U+002A Asterisk
? U+003F Question Mark
< U+003C Less-Than Sign
> U+003E Greater-Than Sign
| U+007C Vertical Line
" U+0022 Quotation Mark

Non-alphanumeric characters in sorting order. Keyboard characters are marked (kbd).
! U+0021 Exclamation Mark (kbd)
# U+0023 Number Sign (kbd)
$ U+0024 Dollar Sign (kbd)
% U+0025 Percent Sign (kbd)
& U+0026 Ampersand (kbd)
( U+0028 Left Parenthesis (kbd)
) U+0029 Right Parenthesis (kbd)
, U+002C Comma (kbd)
. U+002E Full Stop Period (kbd)
; U+003B Semicolon (kbd)
@ U+0040 Commercial At At Sign (kbd)
[ U+005B Left Square Bracket (Left Bracket) (kbd)
] U+005D Right Square Bracket (Right Bracket) (kbd)
^ U+005E Circumflex Accent (Circumflex) (kbd)
_ U+005F Low Line (Underscore) (kbd)
` U+0060 Grave Accent (Back Accent) (kbd)
{ U+007B Left Curly Bracket (Left Brace) (kbd)
} U+007D Right Curly Bracket (Right Brace) (kbd)
~ U+007E Tilde (kbd)
´ U+00B4 Acute Accent
‖ U+2016 Double Vertical Line
‽ U+203D Interrobang
+ U+002B Plus Sign (kbd)
⁄ U+2024 Fraction Slash
∕ U+2215 Division Slash
= U+003D Equals Sign (Equal Sign) (kbd)
± U+00B1 Plus-Minus Sign
× U+00D7 Multiplication Sign
÷ U+00F7 Division Sign
§ U+00A7 Section Sign
† U+2020 Dagger
‡ U+2021 Double Dagger
• U+2022 Bullet
[Numbers in this order: 0 1 2 3 4 5 6 7 8 9] (kbd)
[Letters Case is preserved but not differentiated.] (kbd)
[Certain Unicode characters]

Notes
Spaces are not allowed as the first character of a filename, but are allowed when placed directly into other parts of a filename, including the end.
U+0020 Space
U+00A0 No-Break Space

Prefaces The following four characters, when preceding a space, sort before all others while following the order below. When preceding any other character, they sort with that character, but preceding the character itself.
' U+0027 Apostrophe (kbd)
­- U+00AD Soft Hyphen
- U+002D Hyphen-Minus (kbd)
‐ U+2010 Hyphen (Unicode 2010)

After Z It may be desirable to create filenames, especially prefix characters, that sort after all alphabetic characters. Several of the following Unicode characters look presentable in a prefix arrangement.
ο U+03BF Greek Small Letter omicron
о U+043E Cyrillic Small Letter O
꞉ U+A789 Modifier Letter Colon
꞊ U+A78A Modifier Letter Short Equals Sign
Example Yak
Zebra
ο Funny Pictures

Base+Suffix Filenames with a spaced suffix sort preceding the simpler base filename. Unspaced suffix filenames sort following the simpler base filename. See the following example. Thanks for nothing, Microsoft.
Name 1.txt
Name 2.txt
Name.txt
Name1.txt
Name2.txt


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.