Using Expression fields to manipulate page numbering (95886)



The information in this article applies to:

  • Microsoft Word for Windows 1.0
  • Microsoft Word for Windows 1.1
  • Microsoft Word for Windows 1.1a
  • Microsoft Word for Windows 2.0
  • Microsoft Word for Windows 2.0a
  • Microsoft Word for Windows 2.0b
  • Microsoft Word for Windows 2.0c
  • Microsoft Word for Windows 6.0
  • Microsoft Word for Windows 6.0a
  • Microsoft Word for Windows 6.0c
  • Microsoft Word for Windows 95
  • Microsoft Word for Windows 95 7.0a
  • Microsoft Word 97 for Windows
  • Microsoft Word for Windows NT 6.0
  • Microsoft Word for the Macintosh 6.0
  • Microsoft Word for the Macintosh 6.0.1
  • Microsoft Word for the Macintosh 6.0.1a
  • Microsoft Word 98 Macintosh Edition
  • Microsoft Word 2000
  • Microsoft Word 2002
  • 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 "Continued" on every page except the final page and on the final page, display "End"

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 "Continue reading on page x" (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 "{ PAGE }" "" }

Do not display page numbers on the first two pages, but on the third page display the page number as 1

{ IF { PAGE } < 3 "" "{= { PAGE } - 2}" }

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 "{ PAGE }" "{ = { PAGE } + x }" }

Display "Continued" on every page except the final page and on the final page, display "End"

{IF { PAGE } < { NUMPAGES } "Continued" "- End -" }

REFERENCES

Word version 2.0 for Windows Help, "Field Types and Instructions" section, "Expression" and "Numpages" topics.

"Microsoft Word for Windows User's Reference," pages 95-96, 103

Modification Type:MajorLast Reviewed:9/6/2006
Keywords:kbfield kbformat kbinfo KB95886