# How To Format A Telephone Number Using The TEXT Function

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

### John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

### Subscribe

Subscribe for awesome Microsoft Excel videos ðŸ˜ƒ

## Related Posts

#### 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.

#### 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.

#### Amazing Excel Tips and Tricks

A compilation of the best Excel tips and tricks ranging from beginner to pro that will save you time and make you more productive.