Pinterest Pixel

Change Phone Area Codes with Excel’s REPLACE Formula

Bryan
What does it do?

What does it do?

Replaces part of a text string, based on the number of characters you specify, with a different text string

Formula breakdown:

=REPLACE(old_text, start_num, num_chars, new_text)

What it means:

=REPLACE(this cell, starting from this number, all the way to this number, with this new text)


There are times when we are given a bunch of data that is not clean, and we needed to make manual adjustments to it.

For example, we have a set of phone numbers that have incorrect area codes in them.

We want to replace each phone number’s old area code with a new area code, specified in the NEW column:

Change Phone Area Codes with Excel’s REPLACE Formula

We want to change the area code of 370, into the area code of 111.

For the second phone number, we want to change the area code of 961 to 222…and so on.

The REPLACE formula in Excel can help you clean & replace the text very very easily…goodbye to slow manual adjustments!

I explain how you can do this and please go to the bottom of the page to see the animated gif tutorial:

Change Phone Area Codes with Excel’s REPLACE Formula | MyExcelOnline

download excel workbook Replace-Phone-Area.xlsx

 

STEP 1: We need to enter the Replace function next to the cell that we want to clean the data from:

=REPLACE

STEP 2: The Replace arguments:

old_text

Which text do we want to change?

Reference the cell that contains the text string:

=REPLACE(A11,

Change Phone Area Codes with Excel’s REPLACE Formula

 

start_num

Which character do we want to start the replacement from?

We want to replace the area code 370, which is the 2nd character in the phone number.  The open parenthesis ( is the 1st character:

=REPLACE(A11, 2,

 Change Phone Area Codes with Excel’s REPLACE Formula

 

num_chars

How many characters do we need to replace?

We want to replace the area code 370, which is 3 characters long:

=REPLACE(A11, 2, 3,

Change Phone Area Codes with Excel’s REPLACE Formula

 

new_text

What text will serve as the replacement?

We want to replace the area code 370 with the area code of 111. The replacement values are in the next column (column B):

=REPLACE(A11, 2, 3, B11)

Change Phone Area Codes with Excel’s REPLACE Formula

 

STEP 3: Do the same for the rest of the cells by dragging the REPLACE formula all the way down using the left mouse button.

Note that all of the phone numbers are now clean:

Change Phone Area Codes with Excel’s REPLACE Formula

 

 

If you like this Excel tip, please share it



Change Phone Area Codes with Excel’s REPLACE Formula | MyExcelOnline


Bryan

Bryan Hong is an IT Software Developer for more than 10 years and has the following certifications: Microsoft Certified Professional Developer (MCPD): Web Developer, Microsoft Certified Technology Specialist (MCTS): Windows Applications, Microsoft Certified Systems Engineer (MCSE) and Microsoft Certified Systems Administrator (MCSA).

He is also an Amazon #1 bestselling author of 4 Microsoft Excel books and a teacher of Microsoft Excel & Office at the MyExecelOnline Academy Online Course.

See also  10 + 1 Ways to Round Numbers in Excel

Star 30 Days - Full Access Star

One Dollar Trial

$1 Trial for 30 days!

Access for $1

Cancel Anytime

One Dollar Trial
  • Get FULL ACCESS to all our Excel & Office courses, bonuses, and support for just USD $1 today! Enjoy 30 days of learning and expert help.
  • You can CANCEL ANYTIME — no strings attached! Even if it’s on day 29, you won’t be charged again.
  • You'll get to keep all our downloadable Excel E-Books, Workbooks, Templates, and Cheat Sheets - yours to enjoy FOREVER!
  • Practice Workbooks
  • Certificates of Completion
  • 5 Amazing Bonuses
Satisfaction Guaranteed
Accepted paymend methods
Secure checkout

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...