Showing a Dynamic Number Range in a Header

Written by Allen Wyatt (last updated March 1, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021


2

Mark uses a series of SEQ fields to number items on a page. In the header for the page, he would like to show the range of numbered items that appear on the page, such as 1234-1249. The SEQ fields work flawlessly, but Mark needs the header to update automatically to reflect the actual numbered sequence (first through last) on that page.

This is actually rather easy to do using the fields provided in Word. Fields allow you to create dynamic content, and in Mark's situation they can really shine. Before using the fields, however, there is a bit of "prep work" that needs to be done.

First, you'll need to make sure that the SEQ fields in your document are formatted with a style. Since the SEQ fields are (more than likely) not the only thing within the paragraph in which they are located, you should format them using a character style, not a paragraph style.

For instance, let's say that you create a style called MyNums that you intend to use for your SEQ fields. Apply it to all of them (just the SEQ fields, not anything else), and you will be ready to set up your headers.

Now, within your headers you are going to use the STYLEREF field to reference the first and last SEQ on each page. By default, the STYLEREF field displays the first content on a page that is formatted with a particular style. So, for instance, if you used this field you would get the first SEQ on the page that is formatted with the MyNums style:

{ STYLEREF "MyNums" }

Normally, people think of using the STYLEREF field to reference headings within a document, such as to create a running header that shows the first paragraph formatted with the Heading 1 style or the Heading 2 style on the page. This works fine, but you can also use STYLEREF to reference character styles, such as to reference the MyNums style.

If you want to reference the last occurrence of content formatted with the MyNums style, you would, instead, use the following field:

{ STYLEREF "MyNums" \l }

That's a lowercase "L" at the end of the field. This particular switch instructs Word to start its search for the MyNums style from the end of the page, going upwards. That way you get the last item formatted using MyNums.

So, to do what Mark wants done, you would use the following within the header for the document:

{ STYLEREF "MyNums" }-{ STYLEREF "MyNums" \l }

Remember that the {braces} are not actually typed into the heading; they are field braces and are inserted by pressing Ctrl+F9. Once the fields are inserted in the header, you can select them all and press Shift+F9 to collapse the fields and show the range of SEQ fields on the page.

You may notice that once you have the header set up, it may not appear to automatically update as you add new items to your pages. This is normal; the field codes are usually only updated when you go to print your document. Rest assured that they will reflect the correct range of items on the page when you actually do print.

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

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

Picking Up Where You Left Off

Need a quick way to get back to a where you previously edited? Here's a shortcut that will serve you well.

Discover More

Jumping To a Comment

Got a document with lots of comments in it? You can navigate from comment to comment with ease by using the Go To tab of ...

Discover More

Editing Graphic Objects

Want to change the way that a graphic object appears in your worksheet? You need to edit it, then, using the techniques ...

Discover More

Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!

More WordTips (ribbon)

Using the SYMBOL Field

The most common way of adding symbols to a document is to use the Symbol dialog box. There is another way, however, that ...

Discover More

Manual Line Breaks in STYLEREF Results

The STYLEREF field returns all the text referenced by a given style. When the text includes special characters, such as a ...

Discover More

Stopping Fields from Updating when Printing

Fields provide a great way to add dynamic content to your documents. If you don't want those fields to update when you ...

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 one more than 5?

2018-03-26 08:23:54

Jennifer Thomas

Hugh, depending on the complexity of the Invoice code, you might be able to do that with page numbers; just type the letters (SC) before the field in the actual document and then use Format Number to make the page numbering start at the first numbering value (63969).

This would work especially well if it's a one-page invoice; otherwise you'd have to get a bit clever with your section breaks and header linking to get it to increment on the correct page (comment back with more details about the document structure if you need advice on that).

SEQ or LISTNUM fields would be the next solution to try, as those are more customizable, but I hope the above works for you.


2018-03-24 06:46:31

Hugh Gundersen

How about a field that automatically adds 1 to a number on the previous page, bit like a page number but like "Invoice Nr: SC63969" next page would be "Invoice Nr: SC63970" etc?


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.