Formatting Issues

Excel: Display Page Numbers with Leading Zeros in Headers and Footers

Anum MushtaqAnum Mushtaq Nov 12, 2026 868 views

Question details

The user needs Excel header or footer page numbers to display as fixed-width three-digit values with leading zeros.

Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants the built-in &[Page] header or footer field to display values such as Page 001 or Page 025 when printing a worksheet.
Observed behavior
Excel displays the built-in &[Page] field as an unformatted number, such as 1 or 25, and does not provide a number-format option for adding leading zeros.
Before you start

Open the worksheet in Excel and confirm that the page number is inserted through Page Layout > Page Setup > Header/Footer. Decide whether a standard unformatted page number is acceptable before using a VBA-based workaround.

Solution 1Recommended

Use Excel's standard page field without leading zeros

Use this option when ordinary page numbers such as 1, 2, and 25 are sufficient and no macro is needed.

Excel's built-in &[Page] field is automatically generated during printing and does not support custom number formats such as "000". It will therefore display page numbers without leading zeros.

1
Open the Header & Footer tools

In Excel, select the worksheet, open the Page Layout tab, click the Page Setup dialog launcher, and select the Header/Footer tab.

2
Choose a header or footer

Click Custom Header or Custom Footer, place the cursor in the desired section, and select the Insert Page Number button to add the &[Page] field.

3
Check the print preview

Click OK, open File > Print, and review the preview to confirm that the page number appears without leading zeros.

Built-in field limitation: Excel cannot apply a three-digit number format directly to the &[Page] field.
Free Microsoft Office alternative

Try WPS Office for Lightweight Spreadsheet and Print Formatting

WPS Office is a free, lightweight alternative for opening, editing, and printing Excel workbooks. Its familiar spreadsheet interface and Microsoft Office format compatibility make migration simple, although this specific three-digit automatic page-field requirement may still need custom formatting or a macro.

  1. 1. Install WPS Office: Download and open WPS Office, then launch WPS Spreadsheets from the home screen.
  2. 2. Open the Excel workbook: Select Open, choose the .xlsx or .xls file, and review the worksheet in WPS Spreadsheets.
  3. 3. Adjust the print layout: Open the Page Layout tab, use Header and Footer or Page Setup, and configure the report's printable header and footer content.
  4. 4. Preview and export: Choose File > Print to check page breaks and numbering, then print the workbook or save it in a compatible Excel format.
Free and lightweight spreadsheet editor for everyday workbook and print-layout tasksFamiliar interface that helps Excel users migrate with minimal retrainingCompatible with Microsoft Excel .xlsx and .xls workbook formatsSupports headers, footers, page setup, print previews, and common spreadsheet formattingConvenient alternative for reviewing and adjusting formatted reports without a full Microsoft Office subscription
microsoft office alternative - wps office

Frequently Asked Questions

Can Excel format the &[Page] field as 001 directly?

No. Excel's built-in &[Page] field does not accept a number format, so it displays 1 rather than 001. A VBA workaround or manually generated page text is required.

Where do I insert the built-in page number in Excel?

Open Page Layout > Page Setup, select the Header/Footer tab, choose Custom Header or Custom Footer, and click Insert Page Number in the desired section.

What VBA format creates a three-digit page number?

Use Format(pageNumber, "000"). For example, Format(1, "000") returns 001 and Format(25, "000") returns 025.

Will a custom VBA page number update automatically when pages are added?

Not necessarily. A macro must recalculate or refresh the values when page breaks, print areas, or worksheet content changes. Test the print preview after changing the layout.

Can I achieve this with a normal Excel custom number format?

No. Custom number formats apply to cell values, not to Excel's dynamic &[Page] header or footer field.