TEXT Function: Date Formats & Leading Zeros in Excel & Google Sheets

Format dates cleanly inside labels or reports (such as "Nov 2026" or "2026-11") and pad ZIP codes or IDs with leading zeros using TEXT.

1. Format a Date as Month Year or ISO Date With TEXT

Use TEXT(date_cell, "format_code") to turn a date into formatted text—helpful when combining dates into labels or summary headers:

=TEXT(A2, "mmm yyyy")

2. Pad Numbers With Leading Zeros

Supply zeros in the format pattern to keep leading zeros on codes, order numbers, or 5-digit ZIP codes (for example, "00000"):

=TEXT(A2, "00000")

Worked Example: Date & Leading-Zero Formats

Input Value (A2) Format Pattern TEXT Output
2026-11-27 "mmm yyyy" Nov 2026
2026-11-27 "yyyy-mm" 2026-11
42 "00000" 00042

Important Tip

Editorial & Accuracy Note: Tested across Microsoft Excel and Google Sheets with worked sample inputs and outputs. Part of the Know Unlimited Excel & Google Sheets Hub.