How to Add Page Numbers in Excel: Print Headers, Footers, and Custom Formatting
Page numbers in Excel work differently than in Word. Excel doesn't display page numbers on your worksheet — they appear in Print Preview, on printed output, and in Page Layout view. Understanding where and how Excel places page numbers saves a lot of frustration when you're preparing a spreadsheet for distribution or printing.
Why Excel Handles Page Numbers Differently
Excel is built around a grid, not a document flow. Pages aren't fixed — they shift based on your column widths, row heights, print area settings, and paper size. Because of this, page numbers live in the header or footer of the printed page, not inside any cell (unless you manually put them there).
This matters because editing page numbers means editing your header/footer, not your spreadsheet content.
The Standard Method: Adding Page Numbers Through Page Layout View 📄
The most reliable way to add page numbers in Excel:
- Click the Insert tab on the ribbon.
- Select Header & Footer in the Text group.
- Excel switches to Page Layout view and opens the header editing area.
- Click inside the header or footer section (left, center, or right).
- On the Header & Footer contextual tab that appears, click Page Number.
Excel inserts the code &[Page] — this renders as the actual page number when printed or previewed.
To show total pages alongside the current page (e.g., Page 2 of 5):
- After inserting
&[Page], type the word " of " then click Number of Pages. - Result in the field:
&[Page] of &[Pages]
Click anywhere outside the header/footer area to exit editing mode.
Using the Page Setup Dialog for More Control
For more formatting options, go to:
Page Layout tab → Page Setup group → click the small arrow (bottom-right of the group) → select the Header/Footer tab.
From here you can:
- Choose a preset format from the dropdown (e.g., "Page 1 of ?", "Confidential, Page 1")
- Click Custom Header or Custom Footer to manually position page numbers in the left, center, or right section
- Format the page number font, size, and style using the format button (looks like an A with lines)
This dialog also lets you set:
- First page different — useful if your first page is a cover or title
- Different odd and even pages — relevant for double-sided printing
Starting Page Numbers From a Specific Number
By default, Excel starts numbering from page 1. If your spreadsheet is part of a larger document and needs to continue from page 8, for example:
- Open Page Setup (Page Layout → small arrow in Page Setup group).
- Go to the Page tab.
- Change "First page number" from Auto to your desired starting number.
This is especially useful when combining multiple Excel files into a single printed report.
Adding Page Numbers Directly in a Cell (A Different Use Case)
Some users want a page number displayed inside the spreadsheet itself — visible on screen, not just when printing. Excel doesn't have a native cell function for dynamic page numbers, but there are workarounds:
- VBA macro: A short macro can calculate which page a row falls on and write that into a cell. This requires enabling macros and involves some technical setup.
- Manual entry: Simply type the page number as a static value. This breaks if rows are added or deleted.
- CEILING formula approach: Using
=CEILING(ROW()/rows_per_page, 1)can estimate page numbers based on a fixed row count per page — but this doesn't account for manual page breaks.
For most users preparing documents for print, the header/footer method is the practical choice. The in-cell options introduce complexity without much reliability.
Variables That Affect How Page Numbers Behave 🔢
| Variable | How It Affects Page Numbers |
|---|---|
| Print area | Defines which cells are printed — affects total page count |
| Page breaks | Manual page breaks change where pages split |
| Paper size and orientation | Landscape vs. portrait changes how many columns fit per page |
| Margins | Tighter margins = more content per page = fewer pages |
| Scaling | "Fit to 1 page wide" compresses content and changes pagination |
| Row/column size changes | Any edit can shift page boundaries and update numbering |
Because page count is dynamic, the &[Pages] code is always more reliable than hard-coding a total.
Page Layout View vs. Normal View
Page numbers won't appear in Normal view — that's the default grid view. To see them:
- Switch to Page Layout view (View tab → Page Layout) to see headers and footers on screen as you work.
- Use Print Preview (File → Print) to confirm exactly how page numbers will appear on the final output.
If you're collaborating on a file and someone else doesn't see the page numbers, they may simply be in Normal view — the numbers are there, just not displayed in that mode.
When Setup Varies Significantly Between Users
The steps above apply to Excel for Microsoft 365, Excel 2019, and Excel 2021 on Windows. The same functionality exists in Excel for Mac, though the ribbon layout and some menu names differ slightly. Excel Online (the browser version) has limited header/footer editing — you can add basic page numbers but have less control over formatting and placement.
If you're working in Google Sheets, page number insertion works through File → Print → Headers & Footers, and the available options are more limited than desktop Excel.
The "right" approach to page numbering — header vs. footer, position, starting number, format — depends on your document's purpose, whether it's a standalone file or part of a larger package, and how your printer or PDF export handles headers. Those specifics sit entirely within your own workflow.