6 Ways to Add Page Numbers in Microsoft Excel

Wondering how to add page numbers in Excel? Find out the proven and effortless methods from this blog.

Microsoft Excel isn’t an application only for calculation, It’s also used for data storage, data visualization, and various analytical tasks. You may have to add hundreds of pages in an Excel file, depending on the amount of data you need to store there.

Also, you might need to work on a spreadsheet with your colleagues, clients, and stakeholders. Accurate referencing becomes important when people working on a spreadsheet are present in different locations. Otherwise, there will be miscommunication which could be detrimental to a business. For this reason, it’s mandatory to have page numbers in the Excel file for correct referencing.

If you’ve been to any of the above situations, you must be aware of the importance of adding page numbers in an Excel file. Now, the question is, how to add page numbers in Excel.

Well, as you’ve come to this blog, there’s no reason to worry. Just read on and you’ll know the best method to perform this task. But first, take a look at the reasons why you may want to add page numbers in an Excel spreadsheet.

Reasons to Add Page Numbers in Excel

Here’s why you might want to add a page number to your Excel worksheet:

  • Page numbers make it easy to navigate a file when shared with others or printed on paper.
  • When a large Exel file is printed, page numbers help users to organize it properly.
  • Whenever there is a need to reference or cross-reference an Excel file, page numbers make it convenient.
  • Adding page numbers in an Excel file is considered a standard practice in business and professional settings.
  • During collaborative work on an Excel file, page numbers help to track changes and maintain consistency.
  • Page numbers allow users to maintain reading order, especially when the page has a large number of files.
  • Sometimes, people are legally bound to add page numbers in an Excel file due to compliance issues.
  • When you need to submit an Excel file in a court of law, the document should have page numbers as regulatory requirements.
  • When you need to export data from an Excel file to other file formats like PDF, adding page numbers in the source file enables easy page numbering in the destination file format.

Add Page Numbers from the Insert Tab

Insert tab enables you to add various content to your Excel worksheet and one of those is page number. Find below the steps you can follow:

Header and footer element in Excel
Header and footer element in Excel
  1. Open the Excel workbook where you want to add page numbers.
  2. Go to a specific worksheet, like Sheet1.
  3. At the top of the Excel window, you’ll find the Excel ribbon menu with many tabs. Click on the Insert tab.
  4. Within the Insert tab, locate the Text group. Here, you’ll find the Header & Footer button. Click on it.
Adding page numbers and number of pages
Adding Page Numbers and the Number of Pages
  1. Excel will switch to Page Layout view with three text placeholders for headers and footers.
  2. Suppose, you want to put page numbers on the top and in the middle of the page. So, click on the middle header placeholder.
  3. Click on the Header & Footer tab on the Excel ribbon menu.
  4. Inside the Header & Footer Elements block, click on the Page Number button.
  5. Type the word “Of“.
  6. Go to the Header & Footer Elements section again and click on the Number of Pages button.
Switch to Normal view Excel
Switch to Normal view Excel
  1. Click anywhere else on the Excel worksheet page to view the page numbers.
  2. Go to the View tab on the Excel ribbon menu and click on the Normal button to switch to the original spreadsheet view.

Insert Page Numbers From the Page Layout Tab

Another way to add page numbers in your Excel worksheet is through the Page Layout tab. Here’s how it’s done:

Excel status bar page layout view
Excel status bar page layout view
  1. Click on the Page Layout view on the Excel status bar, located on the bottom-right corner of the screen, near the worksheet Zoom In tool.
Page layout view on View tab Excel
Page layout view on View tab Excel
  1. Another way to access the Page Layout view is through View > Workbook Views > Page Layout.
  2. You should now see the Add header and Add footer placeholders.
Header and footer to add page numbers
Header and footer to add page numbers
  1. Click on any of these placeholders and go to the Header & Footer tab to add the Page Number and Number of Pages elements.

Add Page Numbers Using the Page Setup Dialog

You can use this method to add page numbers to one or many worksheets in your workbook.

For one worksheet, you can simply follow the steps mentioned below. If you need to add page numbers for multiple worksheets go to the first worksheet. Then, press the Ctrl key. Now, select all other worksheet tabs to which you must add page numbers. Now, follow these steps:

Page Setup dialog box
Page Setup dialog box
  1. Go to the Page Layout tab.
  2. Click on the Dialog Box Launcher link in the bottom right corner of the Page Setup block.
  3. Page Setup dialog box will open.
  4. Click on the Header & Footer tab.
  5. Click Custom Header if you want to add the page numbers on the top of the Excel worksheet.
  6. Alternatively, click on the Custom Footer button if you need the page numbers at the bottom of the Excel worksheet pages.
Header dialog elements
Header dialog elements
  1. Choose any placeholder from the Left section, Center section, or Right section.
  2. Click on the Insert Page Number element, to the right of the Format Text (A) button.
  3. Enter the word “Of“.
  4. Now, click the Number of Pages button. It’s to the right of the Insert Page Number element.
  5. Click OK on the Footer or Header dialog.
  6. Finally, click OK on the Page Setup dialog.

You should now see page numbers on one or multiple worksheet pages.

How to Change the Starting Page Number

So far, you’ve learned various methods to add page numbers to the pages of your Excel worksheet.

Suppose, you want your Excel report to start from page 50. How do you do it? Here are the steps:

Changing the first page number in Excel
Changing the first page number in Excel
  1. First, add the page number element by using any method that you’ve practiced so far.
  2. Now, go to the Page Layout tab.
  3. Click on the Dialog Box Launcher link to expand the Page Setup commands block into a dialog box.
  4. On the Page Setup dialog, go to the Page tab. It could be the default selection as well.
  5. You should find the First page number on the Page tab of the Page Setup dialog.
  6. Inside the box to the right, you should see Auto. This tells Excel to number pages automatically.
  7. Double-click Auto and delete it by pressing the Backspace or Delete key.
  8. Now, enter the starting number you want in your worksheet pages. For example, 50.
  9. Click OK to save the changes you’ve just made.
  10. You should see that the starting page number has changed to 50 if you switch to the Page Layout view.

How to Add Page Numbers to Worksheets in Continuation

Suppose, there are 3 worksheets in your Excel workbook and each of these contains 50 pages. Now, if you add page numbers to all three worksheets and print the pages, you’ll find three sets of worksheet pages starting with page number 1 and ending with page number 50.

This can be confusing to you when you arrange the printed pages in one report and also to the recipient who would review the report.

Here, what you can do is number the pages in your Excel worksheet sequentially, which is 1 to 150. Here’s how:

  1. Add page numbers to all three worksheets using any of the methods mentioned earlier.
  2. Now, go to the second worksheet.
  3. Access the Page Setup dialog and manually change the starting page number to 51. (I previously mentioned the steps to do so in the earlier section of this article.)
  4. Then, go to the third worksheet.
  5. Here also, manually change the starting page number to 101.

That’s it! When you print all the pages in this Excel workbook, you’ll see pages arranged as 1 to 150 instead of three sets of 1 to 50 pages.

Add Page Numbers Using Excel VBA

Excel VBA allows you to automate the whole process of adding page numbers in Excel. Find below the script as well as the steps to implement it:

Setting up a VBA script to add page numbers
Setting up a VBA script to add page numbers
  1. Press the Alt + F11 keys together to launch the Excel VBA Editor interface.
  2. Click the Insert button on the toolbar.
  3. On the context menu that opens, click on the Module option.
  4. Inside the blank module, copy and paste this Excel VBA script:
Sub AddPageNumbers()
    Dim ws As Worksheet
    Dim totalPageCount As Integer
    Dim pageNumberLocation As String
    
    ' Set the worksheet where you want to add page numbers
    Set ws = ThisWorkbook.Sheets("Sheet1")  ' Replace "Sheet1" with your actual sheet name
    
    ' Prompt the user for page number location preference
    pageNumberLocation = InputBox("Enter page number location (Header or Footer)", "Page Number Location")
    
    ' Initialize total page count
    totalPageCount = ws.PageSetup.Pages.Count
    
    ' Set page number based on user preference
    Select Case UCase(pageNumberLocation)
        Case "HEADER"
            With ws.PageSetup
                .CenterHeader = "&P of " & totalPageCount
            End With
        Case "FOOTER"
            With ws.PageSetup
                .CenterFooter = "&P of " & totalPageCount
            End With
        Case Else
            MsgBox "Invalid location. Page numbers not set."
            Exit Sub
    End Select
End Sub
  1. Click the Save button.
The go back button
The go back button
  1. On the warning message box, click on the Go back button.
Save as type dialog
Save as type dialog
  1. On the Save As dialog, click on the Save as type drop-down.
  2. Choose the XLSM or Macro-Enabled Workbook option.
  3. Click on the Save button.
  4. Close the Excel VBA Editor.

You’ve successfully created an Excel VBA macro named AddPageNumbers. Find below the steps to execute this VBA macro:

Running an Excel VBA
Running an Excel VBA
  1. Press the Alt + F8 keys to open the Macro dialog box.
  2. There, select the AddPageNumbers macro.
  3. Hit the Run button to execute the macro.
  4. The script will show a message box.
  5. There, you must enter the Header text to add the page numbers in the header section.
  6. Alternatively, you can enter the Footer text to insert page numbers as footers.

The above script adds page numbers to only one worksheet of the Excel workbook. If you want to automatically add page numbers to all the worksheets, you can use the following VBA script:

Sub AddPageNumbersToHeaderOrFooter()
    Dim ws As Worksheet
    Dim pageNum As Integer
    Dim locationPreference As String
    
    ' Set the worksheet where you want to add page numbers
    Set ws = ThisWorkbook.Sheets("Sheet1")  ' Replace "Sheet1" with your actual sheet name
    
    ' Prompt the user for page number location preference
    locationPreference = UCase(InputBox("Enter page number location preference (Header or Footer):", "Page Number Location"))
    
    ' Start with page number 1
    pageNum = 1
    
    ' Loop through each sheet in the workbook
    For Each ws In ThisWorkbook.Sheets
        ' Set page number based on user preference
        Select Case locationPreference
            Case "HEADER"
                With ws.PageSetup
                    .CenterHeader = "&P"
                End With
            Case "FOOTER"
                With ws.PageSetup
                    .CenterFooter = "&P"
                End With
            Case Else
                MsgBox "Invalid location preference. Page numbers not set."
                Exit Sub
        End Select
        
        ' Increment page number for the next sheet
        pageNum = pageNum + 1
    Next ws
End Sub

Conclusions

As an Excel user, you might want to add page numbers to your spreadsheet file for a number of reasons. You may have any regulatory obligations to add page numbers or that could be necessary to organize a large document when you have the printed copy.

Whatever the reason, you shouldn’t be worried wondering how to add page numbers in Excel. It’s not a difficult process at all and any Excel user can easily add page numbers following the methods I’ve mentioned above.

So, what are you waiting for? Implement any method of your choice and get the job done quite easily. If you know any other method that’s not included here, tell us in the comment section. Also, don’t forget to tell us which approach did the job for you or which of these methods you found to be difficult.

About the Author

Bipasha Nath

Bipasha Nath

Bipasha is a technical content writer with 10+ years of experience in the technology industry. She previously worked in a SaaS software development company focused on SharePoint, OneDrive, Word, Excel, Word solutions.

Related Posts

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃