How to format phone numbers in Excel

xl.format.phone turns a US number into (512) 555-0148. The 555 prefix on this page is the fictional range, 555-0100 through 555-0199. A real sheet uses the same steps on a real number.

512-555-0148, 5125550148, and 1 512 555 0148 all become that display. Parentheses, hyphens, spaces, dots, and a plus sign are stripped. If 11 digits remain and the first is 1, the country code is dropped. Any other length comes back unchanged, which is how an extension stays out of the formatted string.

The name needs Microsoft 365, Excel 2024, or Excel for the web. Excel 2021 returns #NAME? for LAMBDA.

The workbook that keeps a column of these numbers is the sales pipeline tracker.

The formatted display

xl.format.phone
=xl.format.phone(B1)
=xl.format.phone(B1)B2
Hyphens in, parentheses out
AB
1Raw512-555-0148
2Phone(512) 555-0148
A picture of the format-phone page. 555-0100 through 555-0199 are reserved for fiction. The stored result is the text (512) 555-0148.

Store the source as text. A 10-digit value can survive as a number. A longer value loses digits past Excel’s 15-digit precision, and the formatted result is then wrong in a way the cell does not flag.

Digits only

xl.digits.only keeps each digit and drops the rest. The result is text, so a leading zero would survive. This sample has no leading zero.

xl.digits.only
=xl.digits.only(B1)
=xl.digits.only(B1)B2
Digits kept, punctuation dropped
AB
1Raw512-555-0148
2Digits5125550148
3Length10
A picture of the same fictional number. The result is text, so it does not become a number. LEN of it is 10.

5125550148 has length 10, which is the length xl.format.phone is willing to shape. Letters in a vanity number stay in the digits-only result and usually make the phone function return the original text.

TEXT, when the cell is already a number

TEXT does not clean punctuation. It prints a number with a format code. A 10-digit number that is already in the cell can use (000) 000-0000.

TEXT
=TEXT(B1,"(000) 000-0000")
=TEXT(B1,"(000) 000-0000")B2
A number that is already ten digits
AB
1Number5125550148
2Text(512) 555-0148
A picture of TEXT on a numeric cell. The format code is (000) 000-0000. The display matches the LAMBDA. The result is text, and SUM will ignore it.

The result is text. SUM ignores it, the same way SUM ignores a date that TEXT has turned into words. TEXT does not drop a leading 1 and it does not strip hyphens from a text cell. Use it for a clean numeric value. Use xl.format.phone when the cell still has punctuation or a country code.


Template for this article

Sales Pipeline Tracker

More from the blog