How to show the correct number of pages

To add the line as Page 13 of 27 in your document, see How to include the total number of pages along with the current page number.
To exclude some number of pages from the total number, do the following:
1. Right-click on the field with number of total pages and choose Toggle Field Codes:

2. In the field:

- Add the symbol = and select all previous text in the field:
- Click Ctrl+F9 to add the special brackets:
- Add – 4 to the end of this formula to exclude 4 pages from the total
number of pages in the document:
3. Right-click on the field and choose Toggle Field Codes again to show the updated number of pages.
See also this tip in French: Comment afficher le nombre correct de pages.