{"id":4843,"date":"2016-11-15T16:50:55","date_gmt":"2016-11-15T15:50:55","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=4843"},"modified":"2024-05-17T20:37:37","modified_gmt":"2024-05-17T18:37:37","slug":"change-phone-area-codes-with-excels-replace-formula","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/","title":{"rendered":"Change Phone Area Codes with Excel\u2019s REPLACE Formula"},"content":{"rendered":"<p><em><strong>What does it do?<\/strong><\/em><\/p>\n<p>Replaces part of a text string, based on the number of characters you specify, with a different text string<\/p>\n<p><em><strong>Formula breakdown:<\/strong><\/em><\/p>\n<p>=REPLACE(<span style=\"color: #ff0000\"><span style=\"color: #339966\"><span style=\"color: #0000ff\">old_text, <span style=\"color: #ff0000\">start_num<\/span>, <span style=\"color: #339966\">num_chars<\/span>,<span style=\"color: #ff6600\"> new_text<\/span><\/span><\/span><\/span>)<\/p>\n<p><em><strong>What it means:<\/strong><\/em><\/p>\n<p>=REPLACE(<span style=\"color: #0000ff\">this cell<\/span><span style=\"color: #ff0000\"><span style=\"color: #339966\"><span style=\"color: #0000ff\">, <span style=\"color: #ff0000\">starting from this number<\/span>, <span style=\"color: #339966\">all the way to this number<\/span>,<span style=\"color: #ff6600\"> with this new text<\/span><\/span><\/span><\/span>)<\/p>\n<hr \/>\n<p>There are times when we are given a bunch of data that is not clean, and we needed to make manual adjustments to it.<\/p>\n<p>For example, we have a set of phone numbers that have incorrect area codes in them.<\/p>\n<p>We want to replace\u00a0each phone number&#8217;s old area code with a <strong>new\u00a0area code,<\/strong>\u00a0specified in the <strong>NEW<\/strong> column:<\/p>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-00.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" class=\"alignnone size-full wp-image-4845\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-00.png\" alt=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" width=\"222\" height=\"184\" \/><\/a><\/p>\n<p>We want to change the area code of 370, into the area code of 111.<\/p>\n<p>For\u00a0the second phone number, we want to change the area code of 961 to 222&#8230;and so on.<\/p>\n<p>The <a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/replace-one-character\/\" target=\"_blank\" rel=\"noopener\">REPLACE\u00a0formula in Excel<\/a> can help you clean &amp; replace the text very very easily&#8230;goodbye to slow manual adjustments!<\/p>\n<p>I explain how you can do this and please\u00a0go to the bottom of the page to see the animated gif tutorial:<\/p>\n<div class=\"after-post-box\">\n<p><iframe src=\"https:\/\/www.youtube.com\/embed\/VXBVxwpPuYo?rel=0 \" width=\"800\" height=\"400\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"width: 0px;overflow: hidden;line-height: 0\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><a href=\"https:\/\/www.youtube.com\/c\/MyExcelOnlinecomtutorials?sub_confirmation=1\" target=\"_blank\" rel=\"noopener noreferrer nofollow\"><img loading=\"lazy\" decoding=\"async\" class=\"alignmiddle wp-image-111468 size-full\" style=\"vertical-align: middle\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/04\/1.yt_.png\" alt=\"\" title=\"\"><\/a><\/p>\n<p class=\"line-two\"><a class=\"IRPP_minimalist icon-download button small\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area.xlsx\" data-leadbox-id=\"147284833f72a2:12f08263ab46dc\"><span class=\"ctaText px-3 text-capitalize\"> download excel workbook <i class=\"fa fa-download\"><\/i><\/span><span class=\"postTitle px-3\">Replace-Phone-Area.xlsx<\/span><\/a><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000\"><strong>STEP 1:<\/strong> <\/span>We need to <strong>enter the <i>Replace\u00a0<\/i>function <\/strong>next to the cell that we want to\u00a0clean\u00a0the data from:<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_57_1 counter-flat ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li><a href=\"#\" class=\"scroll-to-download\">Free Practice Workbook<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/#REPLACE\" title=\"=REPLACE\">=REPLACE<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/#old_text\" title=\"old_text\">old_text<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/#start_num\" title=\"start_num\">start_num<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/#i\" title=\"\u00a0\">\u00a0<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/#num_chars\" title=\"num_chars\">num_chars<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/change-phone-area-codes-with-excels-replace-formula\/#new_text\" title=\"new_text\">new_text<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center\"><span class=\"ez-toc-section\" id=\"REPLACE\"><\/span><span style=\"color: #0000ff\">=REPLACE<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"color: #ff0000\"><strong>STEP 2:<\/strong><\/span>\u00a0The Replace\u00a0arguments:<\/p>\n<h2><span class=\"ez-toc-section\" id=\"old_text\"><\/span><em><strong><span style=\"color: #0000ff\">old_text<\/span><\/strong><\/em><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Which text do we want to change?<\/strong><\/p>\n<p><em>Reference the cell that contains the text string:<\/em><\/p>\n<h2 style=\"text-align: center\"><span style=\"color: #000000\">=REPLACE<\/span><span style=\"color: #0000ff\">(A11,<\/span><\/h2>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-01.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" class=\"alignnone size-full wp-image-4846\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-01.png\" alt=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" width=\"556\" height=\"198\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-01.png 556w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-01-300x107.png 300w\" sizes=\"(max-width: 556px) 100vw, 556px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"start_num\"><\/span><em><strong><span style=\"color: #0000ff\">start_num<\/span><\/strong><\/em><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Which character do we want to start the replacement from?<\/strong><\/p>\n<p><em>We want to replace the area code 370, which is the 2nd\u00a0character in the phone number. \u00a0The open parenthesis <strong>(<\/strong> is the 1st character:<\/em><\/p>\n<h2 style=\"text-align: center\"><span style=\"color: #000000\">=REPLACE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(A11,<\/span>\u00a02,<\/span><\/h2>\n<h2><span class=\"ez-toc-section\" id=\"i\"><\/span>\u00a0<a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-02.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" class=\"alignnone size-full wp-image-4847\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-02.png\" alt=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" width=\"558\" height=\"196\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-02.png 558w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-02-300x105.png 300w\" sizes=\"(max-width: 558px) 100vw, 558px\" \/><\/a><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"num_chars\"><\/span><em><strong><span style=\"color: #0000ff\">num_chars<\/span><\/strong><\/em><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>How many characters do we need to replace?<\/strong><\/p>\n<p><em>We want to replace the area code 370, which is 3 characters long:<\/em><\/p>\n<h2 style=\"text-align: center\"><span style=\"color: #000000\">=REPLACE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(A11, 2,<\/span> 3,<\/span><\/h2>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-03.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" class=\"alignnone size-full wp-image-4848\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-03.png\" alt=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" width=\"551\" height=\"199\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-03.png 551w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-03-300x108.png 300w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"new_text\"><\/span><em><strong><span style=\"color: #0000ff\">new_text<\/span><\/strong><\/em><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>What text will serve as the replacement?<\/strong><\/p>\n<p><em>We want to replace the area code 370\u00a0with the area code of 111. The replacement values are in the next column (column B):<\/em><\/p>\n<h2 style=\"text-align: center\"><span style=\"color: #000000\">=REPLACE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(A11, 2, 3,<\/span>\u00a0B11)<\/span><\/h2>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-04.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" class=\"alignnone size-full wp-image-4849\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-04.png\" alt=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" width=\"503\" height=\"199\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-04.png 503w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-04-300x119.png 300w\" sizes=\"(max-width: 503px) 100vw, 503px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000\"><strong>STEP 3:<\/strong> <\/span>Do the same for the rest of the cells by dragging the <b>REPLACE\u00a0<\/b>formula all the way down using the left mouse button.<\/p>\n<p>Note that all of the phone numbers\u00a0are now clean:<\/p>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-05.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" class=\"alignnone size-full wp-image-4850\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-05.png\" alt=\"Change Phone Area Codes with Excel\u2019s REPLACE Formula\" width=\"525\" height=\"222\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-05.png 525w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-Phone-Area-05-300x127.png 300w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":17529,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cos_headline_score":0,"cos_seo_score":0,"cos_headline_text":"Change Phone Area Codes with Excel\u2019s REPLACE Formula","cos_headline_has_been_analyzed":false,"cos_last_analyzed_headline":[],"om_disable_all_campaigns":false},"categories":[3,304,14],"tags":[142,188,70],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/4843"}],"collection":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/comments?post=4843"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/4843\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/17529"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=4843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=4843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=4843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}