Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with finding the last page using field codes.

    I am trying to put in a footer the words "End of Document" when the last page is reached. I tried the formula: IF {PAGE} = {NUMPAGES} "End of Document" ""

    But it does not work.

    Any advice would be appreciated.

    Thank you,
    lmnorms

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,783
    Thanks
    0
    Thanked 162 Times in 150 Posts
    The field code would be:
    {IF {PAGE} = {NUMPAGES} "End of Document"}
    where all the field braces (i.e. { }) are created in pairs via Ctrl-F9.

    Do note that, if you have your page numbering starting at other than 1 on the first page and/or you have any changes in the page numbering sequence in the document, the PAGES & NUMPAGES fields might not give the exact value you need to test - you may need to add or subtract the difference from either side of the equation. For example, if, on the last page {PAGE} returns 120 but {NUMPAGES} returns 130, you would need:
    {IF {={PAGE}+10} = {NUMPAGES} "End of Document"}
    or:
    {IF {PAGE} = {={NUMPAGES}-10} "End of Document"}
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #3
    New Lounger
    Join Date
    Mar 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. Cheers to you.

    The mistake I did was try to type in the braces '{}' through the formula wizard. The system would not 'see' them as code.

    To fix:
    Delete out old/bad formula.
    I opened up field by typing in cntl +F9 then enter in 'PAGE'. --- {PAGE}
    THen I put the cursor next to that and did it again for NUMPAGES. ---{Page}{NUMPAGES}
    THen highlighted both then hit CNTL+F9 which put the braces on the ends of both fields--- { {Page}{NUMPAGES}}.
    Then typed in 'IF', '=', "End of Document' in appropriate spots. --- {IF{PAGE}={NUMPAGES} "End of Document"}
    Toggled field codes to hide formula. And presto, zingo...it worked.

    PS. Do not copy the formula either. It will not work. It has to be typed in with the use of the CNTL+F9. --- Again, thanks paul.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •