{"id":4790,"date":"2016-11-02T23:46:41","date_gmt":"2016-11-02T22:46:41","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=4790"},"modified":"2023-11-30T21:12:16","modified_gmt":"2023-11-30T20:12:16","slug":"cleaning-data-with-excels-replace-formula","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/cleaning-data-with-excels-replace-formula\/","title":{"rendered":"Cleaning Data with Excel&#8217;s 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<p>&nbsp;<\/p>\n<hr \/>\n<p>There are times when we are given a bunch of data that is not clean, is incorrect or just needs to be updated and we need to make some manual adjustments to it.<\/p>\n<p>For example, we have a set of phone numbers that have incorrect area codes in it:<\/p>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-00.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Cleaning Data with Excel&#039;s REPLACE Formula\"  class=\"alignnone size-full wp-image-4792\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-00.png\" alt=\"Cleaning Data with Excel&#039;s REPLACE Formula\" width=\"231\" height=\"191\" \/><\/a><\/p>\n<p>We want to change the area code of <em>817<\/em>, into the area code <em>123<\/em>.<\/p>\n<p>The <b>REPLACE\u00a0<\/b>formula in Excel can help you change\u00a0the text very very easily&#8230;goodbye to 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\/GSp3ksuRq84?rel=0 \" width=\"800\" height=\"400\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; 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.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace.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.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\/cleaning-data-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\/cleaning-data-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\/cleaning-data-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\/cleaning-data-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\/cleaning-data-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\/cleaning-data-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>&nbsp;<\/p>\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;\">(C10,<\/span><\/h2>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-01.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Cleaning Data with Excel&#039;s REPLACE Formula\"  class=\"alignnone size-full wp-image-4793\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-01.png\" alt=\"Cleaning Data with Excel&#039;s REPLACE Formula\" width=\"561\" height=\"207\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-01.png 561w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-01-300x111.png 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/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 817, which starts from\u00a0the <strong>4th character<\/strong>\u00a0in the phone number sequence:<\/em><\/p>\n<p>1st character is the <strong>+<\/strong><\/p>\n<p>2nd character is the <strong>1<\/strong><\/p>\n<p>3rd character is the <strong>&#8211;<\/strong><\/p>\n<p>4th character is the <strong>8<\/strong><\/p>\n<h2 style=\"text-align: center;\"><span style=\"color: #000000;\">=REPLACE<\/span><span style=\"color: #0000ff;\"><span style=\"color: #000000;\">(C10,<\/span> 4,<\/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-02.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Cleaning Data with Excel&#039;s REPLACE Formula\"  class=\"alignnone size-full wp-image-4794\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-02.png\" alt=\"Cleaning Data with Excel&#039;s REPLACE Formula\" width=\"559\" height=\"200\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-02.png 559w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-02-300x107.png 300w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/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 want to replace?<\/strong><\/p>\n<p><em>We want to replace the area code 817, which is <strong>3 characters long<\/strong>:<\/em><\/p>\n<h2 style=\"text-align: center;\"><span style=\"color: #000000;\">=REPLACE<\/span><span style=\"color: #0000ff;\"><span style=\"color: #000000;\">(C10, 4,<\/span> 3,<\/span><\/h2>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-03.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Cleaning Data with Excel&#039;s REPLACE Formula\"  class=\"alignnone size-full wp-image-4795\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-03.png\" alt=\"Cleaning Data with Excel&#039;s REPLACE Formula\" width=\"553\" height=\"203\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-03.png 553w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-03-300x110.png 300w\" sizes=\"(max-width: 553px) 100vw, 553px\" \/><\/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 817 with the area code<strong> 123<\/strong>:<\/em><\/p>\n<h2 style=\"text-align: center;\"><span style=\"color: #000000;\">=REPLACE<\/span><span style=\"color: #0000ff;\"><span style=\"color: #000000;\">(C10, 4, 3,<\/span> &#8220;123&#8221;)<\/span><\/h2>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-04.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Cleaning Data with Excel&#039;s REPLACE Formula\"  class=\"alignnone size-full wp-image-4796\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-04.png\" alt=\"Cleaning Data with Excel&#039;s REPLACE Formula\" width=\"459\" height=\"197\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-04.png 459w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-04-300x129.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/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-05.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Cleaning Data with Excel&#039;s REPLACE Formula\"  class=\"alignnone size-full wp-image-4797\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-05.png\" alt=\"Cleaning Data with Excel&#039;s REPLACE Formula\" width=\"481\" height=\"224\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-05.png 481w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2016\/10\/Replace-05-300x140.png 300w\" sizes=\"(max-width: 481px) 100vw, 481px\" \/><\/a><\/p>\n<p>&nbsp;<\/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) &nbsp; There are times when we are [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":17638,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cos_headline_score":0,"cos_seo_score":0,"cos_headline_text":"","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\/4790"}],"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=4790"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/4790\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/17638"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=4790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=4790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=4790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}