Display a 10-digit number as a phone number, or an ID as 000-00-0000, using a format code — the cell keeps a plain number you can still sort and match on.
0 placeholders slot each digit into the pattern. The cell’s value stays a number; only the display gets the parentheses and dashes.
The example
A stored number shown as a formatted phone.
| A | B | |
|---|---|---|
| 1 | Stored value | Displays |
| 2 | 2145550918 | (214) 555-0918 |
The formula
A pattern of 0 placeholders:
How it works
Each 0 is a required digit position:
- Enter the number as a plain number (no punctuation):
2145550918. - Apply a custom format where
0marks each digit and literal characters (( ) - space) sit between them. - Excel slots the digits into the pattern from the right; the stored value is unchanged.
- Because it’s still a number, leading-zero IDs need enough
0s in the format to pad them (e.g.00000for a 5-digit ZIP).
Numbers vs text for IDs. This works only while the value is a true number. If an ID can start with zero or exceed 15 digits (credit cards, some account numbers), store it as text instead — numbers drop leading zeros and lose precision past 15 digits. Format codes are for genuine numbers like phones and ZIPs.
Try it: interactive demo
10-digit number → phone format.
Variations
SSN-style ID
Three-part code:
5-digit ZIP
Pad leading zeros:
As text (TEXT)
Bake it into a string:
Pitfalls & errors
Only for true numbers. The format applies to numeric cells. A phone stored as text won’t reformat with this — use the TEXT-based phone recipe for text.
15-digit limit. Numbers lose precision beyond 15 digits, so credit cards / long account numbers must be text.
Leading zeros need padding. A number can’t store a leading zero, so use enough 0 placeholders to pad shorter values.
Practice workbook
Frequently asked questions
How do I format a number as a phone number in Excel?
Why do leading zeros disappear from my IDs?
Should account numbers be numbers or text?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class