Specifying a Collating Sequence for Indexes

by Allen Wyatt
(last updated March 21, 2015)

2

Barry has a document (for a thesis) with index entries (XE fields) of "Gen. 1:20", "Exo. 20:2", and "1 Thes. 4:14". When he generates the index it comes out in alphabetical order (1 Thes. 4:14, Exo. 20:2, Gen. 1:20), but he wants it to be in biblical canonical order, i.e., Gen. 1:20, Exo. 20:2, 1 Thes. 4:14. Barry wonders if there is a way to change the collating sequence so that a document's index is not alphabetical.

The answer to this query is to use an esoteric (some say "undocumented") feature of Word that allows you to override how index entries are sorted. Consider the following index entry—a field—as created by Word:

{ XE "Exo. 20\:2" }

This entry was created by selecting the text "Exo. 20:2" (without the quote marks) and then marking it as an index entry. You can modify how Word sorts the index entry, however, by modifying the field code. Simply follow the entry with a semicolon and the way in which it should be sorted in the index, in this manner:

{ XE "Exo. 20\:2;02Exodus 20\:02" }

In this case I've assigned an arbitrary prefix of "02" before the book name (Exodus) to signify that this is the second book of the bible. I also modified the verse number from "2" to "02" so that any other index entries for the second chapter of Exodus will sort correctly in relation to each other.

I could also have gotten more cryptic with my index sorting code, in this manner:

{ XE "Exo. 20\:2;022002" }

In this case, the code means "book 02, chapter 20, verse 02." If I had actually wanted the scripture reference to be subordinate to a different entry, such as "Old Testament References," then the field code would need to be further expanded, in this manner:

{ XE "Exo. 20\:2;022002:Old Testament References" }

Note the treatment of the two colons in the field: The first one is "escaped out" by the inclusion of the backslash and the second one is not. The backslash is included so that Word understands the colon is not the demarcation between the entry and subentry portions of the field.

You can even go so far as to change the sorting entry of the subentry designation, using the same semicolon as you did in the main entry:

{ XE "Exo. 20\:2;022002:Old Testament References;Bible Verses 1" }

This example causes "Old Testament References" (which is what appears in the actual index) to be sorted as "Bible Verses 1". You could then, with New Testament References, use the sorting code of "Bible Verses 2", which means that they would appear after the Old Testament grouping, as they should.

With this sorting override trick under your belt, you could get creative with your index entries, but it will take a bit of work: every single index entry will need to be manually adjusted to include whatever pattern you want to use for your sorting. This can get tedious (as you might imagine), but you could make it easier by developing your own macros to do the field updating for you. Such a macro would depend on the sorting pattern you established and what you want, exactly, the macro to do. You really should, for example, have one that adds the sorting pattern you want and one that removes it.

You can find additional information about this approach to sorting index entries at the following websites:

http://buildabiblicalreferenceindexwithword.wordpress.com/
http://taxonomist.tripod.com/indexing/wordproblems.html#override

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (7545) applies to Microsoft Word 2007, 2010, and 2013.

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

Selecting a Group of Words

Want to select a chunk of text in a document? Perhaps the easiest way to do this involves using the mouse in conjunction ...

Discover More

Automatically Creating Charts for Individual Rows in a Data Table

If you have a lot of records in a data table, you may want to create individual charts based on the information in those ...

Discover More

Creating a Copy without Formulas

Excel makes copying worksheets (duplicating them) rather easy. However, you may want a worksheet copy that differs from ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Adding Quoted Words to an Index

It is not unusual to need to convert one notation in a document into another entirely different notation. For instance, ...

Discover More

Creating a Single Index from Multiple Documents

When dealing with large projects, it is not uncommon to break the project into multiple documents. When it comes time to ...

Discover More

Putting Bold Words in an Index

There are several ways you can create an index in Word, but the first step is always to figure out what should go in the ...

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}] 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 seven more than 2?

2015-03-23 08:31:37

Carole Jean Haley

This link explains more in depth.
http://www.wordbanter.com/showthread.php?t=54491


2015-03-21 05:47:16

Barry

It's good to know that what I need to do can actually be done in Word. My issue is, though, that I have hundreds of Bible references. I can't imagine going through them all and manually changing { XE "Exo. 20:2" } to { XE "Exo. 20:2;02Exodus 20:02" } etc. Would you happen to know of a macro that would help me with all my references? Thanks.


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.

Newest Tips
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.