Excel Guides

First and Last Names in a Page Header in Excel

When you are working with data in Excel, it is often helpful to have the first and last names of the people you are working with in the page header. This can be a great way to keep track of who is who, and it can also help you to remember which data belongs to which person. There are a few different ways that you can add first and last names to the page header in Excel.

One way to do this is to simply type the first and last names into the header. To do this, click on the cell in the header that you want to use for the first name, and then type the first name into the cell. Next, click on the cell next to it and type the last name into that cell. You can format these cells however you like, and you can even add additional information, such as titles or initials.

Another way to add first and last names to the page header is to use a formula. To do this, click on the cell in the header that you want to use for the first name, and then type =firstname(A1) into the cell. In this example, A1 is the cell where you have entered your data for the first name. You can then copy this formula down for as many rows as you need. For the last name, you would use a similar formula, but with =lastname(A1).

You can also use a macro to add first and last names to the page header. To do this, open the Visual Basic Editor (VBE) by pressing Alt+F11 on your keyboard. Then, insert a new module by going to Insert > Module. In the module, enter the following code:

Sub AddNamesToHeader() Dim ws As Worksheet Set ws = ActiveSheet ws.PageSetup.LeftHeader = "&A" & ws.Range("A1").Value & "&B" & ws.Range("B1").Value End Sub

This code will add the contents of cells A1 and B1 (the first and last name cells) to the left header of your worksheet. You can then run this macro by going to Run > Run Sub/UserForm or by pressing F5 on your keyboard.

Adding first and last names to a page header can be a helpful way to keep track of your data in Excel. There are a few different ways that you can do this, so choose whichever method works best for you.

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.