Written by Allen Wyatt (last updated December 18, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365
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.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Third-party programs can be used to affect a document and change what is contained therein. Of course, getting rid of ...
Discover MoreOnce you save a document on disk, it is stored in a particular folder (or location) on that disk. You may want that ...
Discover MoreSimple page numbering is easy to add to your documents. More complex numbering (such as two numbering schemes in the same ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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).
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments