You created an index in Word, but one subentry appears above its main entry instead of below it. This happens even though you set the sort order correctly. The problem is usually caused by a hidden formatting character, an extra space, or a tab inside the index entry field code.
Word uses field codes like XE to mark index entries. If the field code contains a stray space, a paragraph mark, or an incorrect separator, Word sorts the entry based on the wrong text. The subentry then lands in the wrong position.
This article explains why the mis-sorting occurs and provides step-by-step methods to fix it. You will learn how to inspect field codes, remove hidden characters, and rebuild the index so all entries appear in the correct order.
Key Takeaways: Fixing Index Subentry Sort Order
- Show field codes with Alt+F9: Reveals the hidden XE field code where extra spaces or tabs cause incorrect sorting.
- Use Show/Hide (Ctrl+Shift+8): Displays paragraph marks, tabs, and spaces inside index entries that shift subentry positions.
- Insert > Index > Custom Index > AutoMark: Automates consistent field code formatting to prevent stray characters from breaking sort order.
Why a Subentry Appears Above Its Main Entry in the Index
Word sorts index entries alphabetically based on the text inside the XE field code. The field code structure is:
XE "Main Entry:Subentry"
The colon between the main entry and the subentry tells Word to nest the subentry under the main entry. If the colon is missing, or if a space, tab, or paragraph mark appears before the colon, Word treats the subentry as a separate main entry. The subentry then sorts above the real main entry if its text starts with an earlier letter.
Common Causes of Mis-Sorted Subentries
The following issues produce a subentry that appears above its main entry:
- A space before the colon:
XE "Main Entry :Subentry" - A tab inserted by pressing Tab inside the field code
- A paragraph mark inside the field code from pressing Enter while editing
- An extra space after the colon:
XE "Main Entry: Subentry" - A missing colon:
XE "Main Entry Subentry"
Any of these characters changes the text that Word uses for sorting. The subentry is then sorted as an independent entry.
How to Fix Mis-Sorted Index Subentries
Follow these steps to locate and remove the hidden characters that cause the sort order error. You must first reveal the field codes and formatting marks, then edit each problematic entry, and finally update the index.
Step 1: Show Field Codes and Hidden Characters
- Press Alt+F9
This toggles the display of field codes. AllXEfield codes become visible in your document. Each code appears inside curly braces like{ XE "Main Entry:Subentry" }. - Press Ctrl+Shift+8
This shows paragraph marks, tabs, spaces, and other hidden formatting symbols. A space appears as a small dot, a tab as an arrow, and a paragraph mark as a pilcrow.
Step 2: Inspect Each Problematic Field Code
- Scroll to the mis-sorted subentry in the index
Note the text of the subentry and its main entry. For example, if “Cats” appears above “Animals”, the subentry is “Cats” and the main entry is “Animals”. - Search the document for the field code
Press Ctrl+F and type the subentry text. Look for theXEfield code that contains that text. The code will appear as{ XE "text here" }. - Check the colon and surrounding characters
Look for spaces, tabs, or paragraph marks before or after the colon. A correct code looks like{ XE "Animals:Cats" }. An incorrect code might look like{ XE "Animals :Cats" }or{ XE "Animals: Cats" }.
Step 3: Remove Stray Characters
- Delete any spaces before the colon
Place your cursor between the main entry text and the colon. Press Backspace to remove spaces. The colon should immediately follow the last character of the main entry. - Delete any spaces after the colon
Place your cursor between the colon and the subentry text. Press Delete to remove spaces. The subentry text should immediately follow the colon. - Remove tabs and paragraph marks
If you see a tab arrow or a pilcrow inside the field code, select it and press Delete. These characters break the field code syntax.
Step 4: Update the Index
- Right-click anywhere inside the index
A context menu appears. - Select Update Field
Word rebuilds the index using the corrected field codes. The subentry should now appear below its main entry.
If the Index Still Shows the Subentry in the Wrong Position
Word Does Not Update the Index After Editing Field Codes
The index may still display the old order if you did not update it. Right-click the index and choose Update Field. If the index still looks wrong, delete the entire index and insert it again. Go to Insert > Index, click OK, and confirm that you want to replace the existing index.
The Field Code Contains a Hidden Bookmark or Cross-Reference
A bookmark or cross-reference inside the XE code can alter the sorting text. Press Alt+F9 to view the full code. Look for syntax like XE "Main Entry:Subentry" \b BookmarkName. Remove the \b switch and the bookmark name if it is not needed. Then update the index.
The Subentry Uses a Different Main Entry Spelling
If the main entry in the field code has a typo or a different spelling than the other entries, Word treats it as a separate main entry. Check the spelling of both the main entry and the subentry. Make sure they match the other entries in the index. Correct any typos and update the index.
Correct vs Incorrect Index Field Code Format
| Element | Correct Format | Incorrect Format |
|---|---|---|
| Field code syntax | { XE "Animals:Cats" } |
{ XE "Animals :Cats" } |
| Space before colon | None | One or more spaces |
| Space after colon | None | One or more spaces |
| Tab inside code | None | Tab character present |
| Paragraph mark inside code | None | Paragraph mark present |
| Colon present | Yes | Missing colon |
You can now inspect and correct any index field code that causes a subentry to appear above its main entry. Use Alt+F9 and Ctrl+Shift+8 to reveal hidden characters, edit the field code to remove stray spaces and tabs, then update the index. For large documents, consider using the AutoMark feature with a concordance file to ensure all entries use consistent formatting and avoid this issue entirely.