In this Excel tutorial, you will learn how to add page number in Excel. You will also learn to add sequential page numbers, page numbers on even or odd pages, and customized first-page number. Besides, you will also learn how to remove the added page number in Excel.
We have used Microsoft 365 for the examples and applications. However, they are also applicable to other versions too.
Page number in Excel is the process of adding sequential numbers to the pages of printed documents. For a large amount of data, page number helps to organize the workbook. It allows the user to navigate through pages and define references easily. At the time of cross-referencing, it is a big help for the user. It also produces a touch of professionalism in your workbook.
Here I have added the page number with the total number of pages at the header.
Download Practice Workbook
How to Add Page Number on Single Worksheet
We will add the page number on a single worksheet with the available options in the Header & Footer tab.
- Click on the worksheet name to select a specific single worksheet.
- Go to the Insert tab and select Header & Footer from the ribbon.
- Select Header —> Header & Footer Tab —> Header Option —> Pick a Format.
- Click anywhere on the sheet and we will have the page number at the center of the header.
- Select Header —> Header & Footer Tab —> Header & Footer Elements group —> Page Number.
- We will have &[Page] at the defined place.
- Just click outside the header, and we will have the page number on the worksheet.
How to Add Page Number on Multiple Worksheets
We will discuss adding page numbers in the middle of the header in multiple worksheets.
- Keep the Ctrl key pressed and click on the worksheet tabs to select them.
- Open the Page Setup dialog box and click on Custom Header… from Header/Footer.
- Write the page number format in Center section.
- Click OK again.
We have page numbers in the middle of the header in multiple worksheets.
Alternate Ways of Multiple Sheet Selection:
- To select adjacent multiple worksheets, click on the first sheet name and click on the last sheet name till you want to select holding the Shift key.
- To select all the worksheets, right-click on the mouse putting the cursor on sheet name and select Select All Sheets.
How to Add Sequential Page Numbers in Excel
This section is to demonstrate the normal numbering procedure of multiple pages.
- Select Header —> Header & Footer Tab —> Header Option —> Page 1 of ? format.
- Page numbers will be inserted sequentially.
How to Enable Header & Footer Tab
To enable the Header & Footer tab, go to the Insert tab and select Header & Footer from the ribbon.
Alternatively, go to the View tab —> Workbook Views group —> Page Layout.
How to Have Customized First Page Number
This section describes the procedure to have a customized first-page number. For more clarification, we will add the date and time on the first page only.
- Go to Header & Footer —> check the Different First Page box.
- Insert a page number format with the tools of Header & Footer Elements according to your preferences.
- The unique style of page number for the first page will be set and it won’t be applied to the rest of the other pages.
How to Add Page Numbers on Odd or Even Pages
This portion is to describe the procedure to add page numbers on odd pages.
- Go to the Header & Footer tab —> Options group —> check the Different Odd & Even Pages option
- Select the Header of an odd page.
- Insert the page number format.
- We can see that the page number is added only on the odd pages and the even pages will not have any page number.
How to Use Random Number to Start Page Numbering
We will pick a random number and use it to start page numbering.
- Go to the Page Layout tab —> click on the extension key of the Page Setup group.
- Go to the Page tab —> set the number as the First page number field —> click OK.
- Finally, the defined page number will be set as the first page number.
How to Define Page Numbering Order (Down, Then Over or Over, Then Down)
There are two types of the page numbering order. One is to number the page row-wise first and then move to column-wise (over, then down). Another one is to number the page column-wise first and then move to row-wise (down, then over).
- To set the page numbering order, click on the extension key of the Page Setup group from the Page Layout tab.
- Go to the Sheet tab —> select Over, then down from Page Order —> click OK.
- The page number will be set over the columns first and then downwards.
- You can select a page numbering order Down, then over from Page Order.
Then, you will have page numbers downwards first and then over the columns.
How to Modify Page Number Format
We will modify the added page number format here.
- To change the font of the page number, select page number command —> Home tab —> Font group —> Font.
- We can change the font size by selecting page number command —> Home tab —> Font group —> Size.
- We have further modified the page number format with the Bold and Font Color options from the Font group.
We have clicked outside of the page number box and found a modified page number according to our commands.
How to Insert Page Number in Selected Cell
We will use VBA to insert a page number in a selected cell of a worksheet.
- Select a cell —> Developer tab —> Visual Basic.
- .From Visual Basic Editor, Insert —> Module.
- Write the following VBA code.
Dim xVCount As Integer
Dim xHCount As Integer
Dim xVBreak As VPageBreak
Dim xHBreak As HPageBreak
Dim xNumPage As Integer
xHCount = 1
xVCount = 1
If ActiveSheet.PageSetup.Order = xlDownThenOver Then
xHCount = ActiveSheet.HPageBreaks.Count + 1
xVCount = ActiveSheet.VPageBreaks.Count + 1
xNumPage = 1
For Each xVBreak In ActiveSheet.VPageBreaks
If xVBreak.Location.Column > ActiveCell.Column Then Exit For
xNumPage = xNumPage + xHCount
For Each xHBreak In ActiveSheet.HPageBreaks
If xHBreak.Location.Row > ActiveCell.Row Then Exit For
xNumPage = xNumPage + xVCount
ActiveCell = "Page " & xNumPage & " of " & Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
We will have the page number in the selected cell.
Read More: How to Insert Page Number in Excel
How to Remove Page Number
If your Excel file comes with page numbers already there and you don’t want that, you can remove them using the following options.
To remove the page numbers, select the page numbering commands from the header or footer and remove them from there.
2. Using Page Setup Dialog Box to Remove Page Number
We will use the Page Setup dialog box to remove the page numbers.
- Open the Page Setup dialogue box.
- Go to Custom Header or Custom Footer based on your page number location.
- Remove the page numbering command —> click OK —> click OK again.
Which Things Should You Remember?
- Usually, page numbers are added as either a header or footer.
- Page numbers can’t be seen in Normal mode.
- In the time of numbering even page numbers only, you need to be on one of the even pages.
This concludes our discussion on the page number in Excel. It includes multiple ways of adding page numbers in the header and footer through the Header & Footer tab and the Page Setup dialogue box. Hopefully, you have also learned to add page numbers in the sequential or custom order as we described in these procedures.
We also included two different methods to remove page numbers in Excel. They also follow the same route of adding them.
I hope this article will be helpful for you. For any further questions, please comment below. You can also visit our site for more Excel-related articles. Thank you.
Frequently Asked Questions
1. Is it possible to customize the number of rows and columns on a page?
We can easily customize the number of rows and columns on a page. For this, go to the Page Break Preview mode from the View tab and move the page border lines to customize the page.
2. Is it possible to reset the number of rows and columns on a page?
We can reset the customized number of rows and columns on a page. For this, open the Page Setup dialogue box and input 1 in the Fit to and Wide by boxes, and click on OK.
3. Is there a formula for page numbers in Excel?
No, there is no built-in formula for page numbers in Excel, but there is code to do so as we have discussed in the above sections of the article.
Page Number in Excel: Knowledge Hub