Create a Word Index with Song Numbers Instead of Page Numbers
Question details
Create a Word index that displays each song's numbered list position instead of its page number.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- A song list uses numbered headings, and the user wants an index that retrieves the song numbers automatically.
- Observed behavior
- The index shows song titles, but the attempted automatic entry does not display a song number.
Check that each song title uses the same heading style and an automatic list number. The example below uses Heading 2; substitute your actual style name if it differs.
Use XE and STYLEREF fields to display song numbers
Use this method to retrieve the number of a song's heading as the alternate text for its index entry.
Apply Heading 2 to each song title from Home > Styles, then use Home > Numbering or Multilevel List to give the headings automatic numbers.
Place the cursor in a song heading or the paragraph immediately after it. Insert an XE field with a nested STYLEREF field so the code reads: { XE "Song Title" \t { STYLEREF "Heading 2" \w } }. Replace Song Title with the actual title. Create each pair of field braces with Ctrl+F9 on Windows or Cmd+F9 on Mac; do not type ordinary braces.
Add an XE field for each song, changing the quoted title while keeping the STYLEREF style name matched to the numbered headings.
Use References > Insert Index to create the index. Press Ctrl+A, then F9 on Windows to update fields, and use References > Update Index to refresh the index. On a Mac, select the document and use the field-update command available for your keyboard.
If an entry has no number, check that its heading has an automatic number, the STYLEREF style name is correct, and the nested field uses the \w switch. Update the nested STYLEREF field and then update the index again.

Enter song numbers manually in XE fields
Use this fallback if the nested field does not produce a number or the song list will not change often.
Edit Your Song List in WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for editing song lists and other documents. Its Word-format compatibility helps you move existing files into WPS Writer; the Word-specific nested-field method above is not guaranteed to work in WPS.

Frequently Asked Questions
Why does my index show a song title but no number?
Check that the song heading has an automatic list number and that the nested STYLEREF field names the correct heading style and includes \w. Update the nested field, then choose References > Update Index.
Can I type the braces around a Word field?
No. Insert each pair of field braces with Ctrl+F9 on Windows or Cmd+F9 on Mac. Ordinary typed braces do not create a Word field.
What if my song titles use a style other than Heading 2?
Replace "Heading 2" in each STYLEREF field with the exact name of the style used by the numbered song headings, then update the fields and index.
Can I put the song number in an index entry manually?
Yes. Use an XE field such as { XE "Song Title" \t "1" }, then update the index. You must change the quoted number yourself if the song's position changes.




