Software

Generate multiple indexes in the same Word document

One index is usually enough, but when you need more, use these two tricks to generate exactly the indices you need.

Word

The February 2015 article How to add an index to a Word document using index tags shows how to add an index to a Word document. Now I'd like to show you how to add to individual indices using special switches. You can bookmark sections and index the bookmarked section. Or, you can identify specific terms. In both cases, you selectively index the document to create multiple indices.

I'll be working in Word 2013 on Windows 7; I'll supply instructions for earlier versions as necessary. For your convenience, you can download the example .docx or .doc file, or use an existing document of your own. If you don't know how to generate an index, I recommend that you work through the first article before trying to tackle this more advanced topic. This article assumes you know how to mark terms and generate an ordinary index.

Use the bookmark switch

Generating more than one index based on different sections of the document is the easiest way to add more than one index to the same document. Initially, the process is the same as generating a single index. You begin by marking each term you want included in the index. Then, before you generate the index, you bookmark the different sections. When generating each index, you indicate the bookmarked area you want indexed.

Before you can bookmark anything, you must determine the sections you want indexed. The example document shown in Figure A has two obvious sections: Galleries and Using Galleries. (The text is repeated to keep things simple.)

Figure A

Figure A

Use Show/Hide to display indexed terms.

The example document already contains marked terms. If you're working with your own document, mark a few terms in two different sections or paragraphs. If you don't see the index fields, click Show/Hide in the Paragraph group on the Home tab. This is a toggling option, so a click is all that's required to display or hide formatting symbols. It's on the Standard toolbar in 2003.

With the first step already completed for us, let's move on to the second step — bookmarking the sections Galleries and Using Galleries. To bookmark the Galleries section, do the following:

  1. Select the three short paragraphs in the Galleries section (you don't have to select the section title, but you can).
  2. Click the Insert tab, and then click Bookmark in the Links group. In 2003, choose Bookmark from the Insert menu.
  3. In the resulting dialog, give the bookmark a meaningful but short name. In this case, name the bookmark Galleries (Figure B) and click Add.

Figure B

Figure B

Name the bookmark Galleries.

Repeat this process to create a bookmark named UGalleries after selecting the Using Galleries section. Word displays brackets around bookmarked areas, as shown in Figure C.

Figure C

Figure C

Look for the brackets after adding a bookmark.

Now you're ready to generate an index, but you won't do so using the Insert Index on the References tab. You must insert the index field manually so you can add the bookmark switch as follows:

  1. Click where you want to position the index.
  2. Click the Insert tab.
  3. In the Text group, click the Quick Parts drop-down and choose Field (Figure D). In 2003, choose Field from the Insert menu.
    Figure D
    Figure D
  4. In the Field Names list, select Index.
  5. Below the Field Names list, click Field Codes and Word will display the Field Codes control. (The Field Codes button will then display Hide Codes.)
  6. In the Field Codes control, add \b Galleries \c 2 (Figure E).
    Figure E
    Figure E
  7. Click OK and Word will index only the previously indexed terms in the Galleries bookmark section.

If you're comfortable using the keyboard, you can bypass the seven steps above and enter the index field as follows:

  1. Press [Ctrl]+[F9] to generate a blank field.
  2. Enter the appropriate field text: index \b Galleries \c.
  3. Press [F9] to generate the index.

Using either process, generate the index for the Using Galleries section, but in step 6, add \b UGalleries \c 3. Figure F shows the results of both indices.

Figure F

Figure F

Add two indexes to the same document using the bookmark switch, \b.

The \b switch tells Word to restrict the index to marked terms in the bookmarked sections. The \c switch formats the index in columns. In a working document you'd probably want the indexes to be consistently formatted, but I wanted you to see the flexibility that comes with using these switches by generating both a two- and a three-column index. There aren't enough index terms to force a third column of text, but you can see that there's room for it.

I promised you two methods, so next I'll show you how to add specific terms to an index.

Use the entry type switch

You might want to separate terms in the same sections of the document into one or more indexes. In this case, bookmarks won't help. Instead, use the \f entry type switch. In this example, we'll use \f "abc" and \f "xyz". Notice that we're not referring to a bookmark this time; the strings are arbitrary, but you must match the references, respectively, when you generate each index later. You'll want to use meaningful references and avoid including the term index in the reference. With a bit of testing, I found references that include index to be unreliable.

Don't try to add the switch when marking the term using the Mark Index Entry dialog (Mark Index option). Word can't transfer the switch correctly. Instead, manually add the switch and its argument to an indexed term. To demonstrate, we'll modify only two terms (to keep things simple).

To mark the first term, do the following:

  1. Click inside the right end of the first indexed string, Insert tab, in the first line of the first paragraph following the Galleries heading.
  2. Type \f "abc", as shown in Figure G.

Figure G

Figure G

Alter the existing index field by adding the bookmark switch and its argument.

Next, add the switch \f "xyz" to the Quick Styles field in the Formatting Text subsection in the Using Galleries section.

To generate the abc index, use the keyboard as I showed you earlier or use the interface as follows:

  1. Click where you want to insert the index (I added a header so you can visually distinguish between the two).
  2. Click the Insert tab and choose Field from the Quick Parts drop-down in the Text group.
  3. Choose Index in the Field Names list.
  4. Click Field Codes.
  5. In the control, add the following string, \f abc (Figure H). (Notice that I did not include the double quotation marks this time.)
    Figure H
    Figure H
  6. Click OK to generate the abc index.

Generate the xyz index, shown in Figure I, using the switch \f xyz (no quotation marks).

Figure I

Figure I

Generate entry type indexes.

Worth noting

We used multiple indexing as an excuse to explore two different ways to add index terms to an index that isn't document-inclusive. In neither case must you generate more than one index. You can use the bookmark method to generate a unique index when you don't want to index the entire document. In addition, the \f switch references can occur in the same section and even the same paragraph. If the resulting index doesn't produce the results you expect, check your arguments for typos and missing quotation marks.

Multiple indexing isn't something most ordinary users will need, but it's a fun exercise. Learning what Word is capable of, even when you don't think you'll utilize the feature, is a great way to expand your Word expertise.

Send me your question about Office

I answer readers' questions when I can, but there's no guarantee. When contacting me, be as specific as possible. For example, "Please troubleshoot my workbook and fix what's wrong" probably won't get a response, but "Can you tell me why this formula isn't returning the expected results?" might. Please mention the app and version that you're using. I'm not reimbursed by TechRepublic for my time or expertise, nor do I ask for a fee from readers. You can contact me at susansalesharkins@gmail.com.

Also see

About Susan Harkins

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks

Free Newsletters, In your Inbox