How To Format A Telephone Number Using The TEXT Function

2016-11-21

 

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,"(###) ###-####","###-####"))

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Subscribe

Advertisement

Related Articles

37 Awesome Excel Mouse Tips & Tricks You Should Know

37 Awesome Excel Mouse Tips & Tricks You Should Know

While the keyboard is generally quicker, you shouldn’t completely ignore the mouse. There are also some great time saving mouse shortcuts as well. In this post we’ll take a look at some of the best Excel mouse time saving tips and tricks.

read more
25 Amazing Power Query Tips and Tricks

25 Amazing Power Query Tips and Tricks

Power query is amazing tool that allows you to import and transform data with ease and helps to create repeatable and robust procedures with your data. Here are some tips and tricks to help you get the most out Power Query.

read more

Comments

0 Comments

Get The Latest News

Follow Us

Follow us on social media to stay up to date with the latest tips in Excel!

Pin It on Pinterest

Share This