Calculating Page Count for a Range of Sections

Written by Allen Wyatt (last updated December 18, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


1

Jessica has a document that has four sections, and she wants to use the format "Page X of Y" for page numbering. She needs to be able to control the "Y" so that it only includes the number of pages in sections 1, 2, and 3 (section 4 is an appendix). Jessica knows she could insert the "Y" manually without using field codes, but the document is one that gets amended from time to time by more than one person and she wants to be sure it will update automatically.

When you insert a "Page X of Y" style of page number, Word is actually using the following text and fields:

Page { PAGE } of { NUMPAGES }

The PAGE field returns the current page number and NUMPAGES returns the number of pages in the entire document. If you want to have the "Y" portion be just the number of pages in the current section, then you can simply change the text and fields to this:

Page { PAGE } of { SECTIONPAGES }

Now the "Y" value will be the result of the SECTIONPAGES field, which is the number of pages in the current section.

If you want the number of pages in the first sections of a document, as a total, then you need to get a bit trickier with your field codes. For instance, in Jessica's case, she may want the "Y" value to be the total of the pages in sections 1, 2, and 3 of her document. Assuming that the page numbering is contiguous for these sections, the easiest way to do this is to define a bookmark on the last page of section 3. For instance, let's say that you name the bookmark something like Sec3End. Then, you can change your "Page X of Y" text and fields to the following:

Page { PAGE } of { PAGEREF Sec3End }

The PAGEREF field, in this case, returns the page number on which the Sec3End bookmark occurs. Since you placed it on the last page of section 3, your "Y" value is now the total number of pages in sections 1, 2, and 3.

If you wanted, instead, to have the "Y" value be the number of pages in a contiguous range of sections that didn't begin with section 1, then your fields need to be a bit more complex. For instance, in Jessica's case, she might want the "Y" value to reflect just the page count in sections 2 and 3. (Why this would be desired is beyond me, but calculating the total pages in the two sections is possible.) In this case, you need a bookmark on the first page of section 2 (let's call it Sec2Start) and the bookmark on the last page of section 3 (which we'll still call Sec3End). You can change your "Page X of Y" text and fields to the following:

Page { PAGE } of { = { PAGEREF Sec3End } - { PAGEREF Sec2Start } + 1 }

All you've done in this instance is to create a compound formula that returns the page numbers for the end of section 3, subtracts the page number for the start of section 2, and then adds 1 to the result. If you need to modify the "X" value in some way, you can do so by concocting a formula based on whatever mixture of PAGE and PAGEREF fields is appropriate for your needs.

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

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

Printing a Range of Pages

If your worksheet, when printed, requires more than a single page to print, you may want to only print a range of the ...

Discover More

Working with Table Columns and Rows

Need to add or delete columns and rows from a table? It's easy to do using the tools provided in Word.

Discover More

Replacing Multiple Spaces with Tabs

If you get a document or some text that has multiple consecutive spaces used to align information, you'll undoubtedly be ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Dates Updating when Converting

Word allows you to convert documents from WordPerfect format to Word. In doing so, you may notice that some dates in the ...

Discover More

Conditional Calculations in Word

Word allows you to insert simple formulas, using fields, in table cells. You can also create simple conditional ...

Discover More

Sequentially Numbering Elements in Your Document

One of the most powerful and useful fields provided by Word is the SEQ field. This tip describes how you can use 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}] (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 four less than 7?

2021-12-20 12:24:24

Victor

A real world situation in which you might want the page count of a range of sections is when you are using sections both for document structure (e.g., sections 2, 3 and 4 are "chapter 2") and document formatting (e.g., in the prior example, "chapter 2" comprises 3 sections because the middle section is oriented landscape).


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.