Microsoft KB Archive/95886

= Using Expression fields to manipulate page numbering =

Article ID: 95886

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Word 1.0 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 2.0 Standard Edition
 * Microsoft Word 2.0a
 * Microsoft Office Word 2003
 * Microsoft Word 2.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a
 * Microsoft Word 97 Standard Edition
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 98 for Macintosh
 * Microsoft Word 2000 Standard Edition
 * Microsoft Word 2002 Standard Edition
 * Microsoft Office Word 2003

-



This article was previously published under Q95886



SUMMARY
This article describes how to use the Expression field and the SUM function together with with the PAGE field to manipulate page numbering in the following ways:
 * Return the current page number plus 1 (or more)
 * Return the number of pages in the document minus a specified number
 * Number the document in reverse order
 * Return the current page number on some pages and display nothing on other pages
 * Do not display page numbers on the first two pages, but on the third page display the page number as 1
 * Return the current page numbers on some pages and display larger page numbers on other page numbers
 * Display &quot;Continued&quot; on every page except the final page and on the final page, display &quot;End&quot;



MORE INFORMATION
Note The field braces {} used to create fields cannot be typed. To create a blank field, you must either use the Field command on the Insert menu to create a specific field or press the CONTROL+F9 keys (COMMAND+F9 in Word for the Macintosh).

To quickly toggle the field codes display, press ALT+F9 (OPTION+F9 on the Macintosh).

Return the current page number plus 1 (or more)
The following Expression field adds 1 to the current page number to return the number of the next page in your document. You can use this field in your header or footer to instruct the reader to &quot;Continue reading on page x&quot; (where x is the result of the Expression field).

{={PAGE}+1}

Return the number of pages in the document minus a specified number
The following Expression field subtracts a specified number (x) from the total number of pages in your document and displays the result:

{={NUMPAGES}-x}

For example, if {NUMPAGES} returns 10 as the total number of pages in the document, {={NUMPAGES}-3} returns 7.

Number the document in reverse order
You can insert the following Expression field in the header or footer to number the pages in your document in reverse order. This method works if your document is numbered continuously, starting at 1. This method does not work if page numbering in your document is not continuous or does not start at 1.

{={NUMPAGES}-{PAGE}}

Note In the following examples, make sure that you leave spaces around the < sign.

Return the current page number on some pages and display nothing on other pages
The following field will display the page numbers on pages one, two and three but will not display the page numbers on any other pages.

{ IF { PAGE } < 4 &quot;{ PAGE }&quot; &quot;&quot; }

Do not display page numbers on the first two pages, but on the third page display the page number as 1
{ IF { PAGE } < 3 &quot;&quot; &quot;{= { PAGE } - 2}&quot; }

Return the current page numbers on some pages and display larger page numbers on other page numbers
The following field will display the current page number on pages one, two, and three, but display a larger number depending on the number that is specified in (x).

For example, if x = 4, the result will be 1,2 and 3 will appear on one, two and three respectively and page four will display 8.

{ IF { PAGE } < 4 &quot;{ PAGE }&quot; &quot;{ = { PAGE } + x }&quot; }

Display &quot;Continued&quot; on every page except the final page and on the final page, display &quot;End&quot;
{IF { PAGE } < { NUMPAGES } &quot;Continued&quot; &quot;- End -&quot; }

