Excel comes right out of the box with codes you can use in the header and footer of your worksheets. They are designed to make it easier for you to include predefined information in your worksheet headers and footers. You can see some of them in the Header or Footer dialog boxes when you click on Custom Header or Footer by clicking a button. Others you have to enter directly.
Command codes are indicated in Excel headers and footers by keying in an ampersand character (&) followed by the command. Below are the codes you can use for some commands.
&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 your workbook
&& – Ampersand character
Now you are all set to include information in your Excel headers and footers!