Header and Footer Data Codes

Written by Allen Wyatt (last updated May 2, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


2

Excel includes a number of codes which you can include in your header and footer. These codes are designed to make including predefined information a bit easier. Some of the codes are available on the Header or Footer dialog boxes (when you click on Custom Header or Custom Footer in the Header/Footer tab of the Page Setup dialog box) by clicking on a button. Others you must enter directly.

Command codes are indicated in Excel headers and footers by typing an ampersand character (&) followed by the command. The following are the data codes you can use:

Code Meaning
&D Current date
&T Current time
&F Workbook name
&A Worksheet name (from the worksheet tab)
&P Current page number
&P+x Current page number plus x
&P-x Current page number minus x
&N Total pages in the workbook
&& Ampersand character

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2056) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Last Non-Zero Value in a Row

If you have a lot of values in a single row, you might want to pull the last non-zero value from that row. There are a ...

Discover More

Using Drag-and-Drop to Create a Hyperlink

If you open workbooks in two instances of Excel, you can use drag-and-drop techniques to create hyperlinks from one ...

Discover More

Working with Record Numbers

Want to keep track of various rows in a data table through the use of record numbers? Here are some options and ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Moving Part of a Footer Down a Line

Setting up a single footer line for your printouts is fairly easy. If you want to move part of the footer down a line so ...

Discover More

Leading Zeros in Page Numbers

Page numbers in Excel printouts are typically simple counters, without much chance for embellishment. If you want to add ...

Discover More

Deleting a Footer

Excel allows you to add footers to the worksheets you create. If you decide you don't need a footer any more, here's how ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

2023-06-22 11:35:33

ti89todd

Are there more codes available than these?
For example, these codes can also be written &[Date], &[Time], etc.
So are there MORE codes, and if so, where are they published?
Can I create my OWN codes through named cell references, or VBA, or formulas?


2021-01-06 21:34:20

sunny

is there control codes for headers/footer for copy/paste across workbooks


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.