Written by Allen Wyatt (last updated May 2, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003
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.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2019 For Dummies today!
Place an ampersand into the text of a page header or footer, and you might be surprised to see it missing in your ...
Discover MoreIf your workbook is destined for the printed page, you need to be concerned with the layout of that page. Excel allows ...
Discover MoreWhen printing out a worksheet, you may want Excel to include, in the footer, the date the data was last saved. There is ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments