001-How-To-Format-A-Telephone-Number-Using-The-TEXT-Function How To Format A Telephone Number Using The TEXT Function

 

Get The Completed Workbook

 

1 Formatting a 7 digit number

 

Let’s say we have a list of phone numbers and we want to have them formatted in the nice usual readable way. For example instead of seeing 2225678 we want to see 222-5678. We can use the following formula.

 

=TEXT(B3,"###-####")

 

2 Formatting a 7 digit number with an area code

 

What if the number has an area code and we want to format the phone number like this, (333) 555-6666? That’s pretty easy as well and we can use the same text formula with a slight modification.

 

=TEXT(B9,"(###) ###-####")

 

3 Mixed Formatting

 

Now let’s say our list of phone numbers is a mixed bag. Some of them are 7 digit without an area code and some are 10 digit with an area code. How can we handle this? In this case we can use an IF and LEN function to help us out. If the length of the number is greater than 7 then we use the first format “(###) ###-####” and if the length of the number is less than or equal to 7 then we use the second format “###-####”.

 

=TEXT(B15,IF(LEN(B15)>7,"(###) ###-####","###-####"))