{"id":5761,"date":"2021-03-11T23:23:35","date_gmt":"2021-03-11T22:23:35","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=5761"},"modified":"2024-04-10T17:29:21","modified_gmt":"2024-04-10T15:29:21","slug":"remove-second-hyphen-with-excels-substitute-formula","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/remove-second-hyphen-with-excels-substitute-formula\/","title":{"rendered":"Remove Second Hyphen with Excel&#8217;s SUBSTITUTE Formula"},"content":{"rendered":"<p>There are times where I needed to <strong>remove the <em>nth occurrence\u00a0<\/em>from my text<\/strong>. \u00a0For example, I would like to how to remove dashes in Excel &#8211; it&#8217;s 2nd occurrence.<\/p>\n<p>Normally I would have to find the second hyphen, split the text based on the hyphen&#8217;s location, merge the remaining parts together&#8230;.pfff&#8230;.it&#8217;s just a headache and prone to errors!!<\/p>\n<p>The<strong> SUBSTITUTE\u00a0<a class=\"wpil_keyword_link\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/top-excel-formulas-function-examples-to-get-better-at-microsoft-excel\/\" target=\"_blank\" rel=\"noopener\" title=\"formula\" data-wpil-keyword-link=\"linked\">formula<\/a> in Excel<\/strong> can actually do this for you! You might be thinking, <em>&#8220;How can substitute remove dash in Excel?&#8221;<\/em><\/p>\n<p>The secret is, we use\u00a0<strong>SUBSTITUTE\u00a0<\/strong>to replace our target character with an\u00a0empty string!<\/p>\n<p>&nbsp;<\/p>\n<p>Let&#8217;s get familiar with the syntax of the Substitute Function in Excel!<\/p>\n<p><em><strong>What does it do?<\/strong><\/em><\/p>\n<p>Substitutes new_text for old_text in a text string.<\/p>\n<p><em><strong>Formula breakdown:<\/strong><\/em><\/p>\n<p>=SUBSTITUTE(<span style=\"color: #0000ff\">text<\/span>, <span style=\"color: #ff0000\">old_text<\/span>, <span style=\"color: #339966\">new_text<\/span>, <span style=\"color: #ff6600\">[instance num]<\/span>)<\/p>\n<p><em><strong>What it means:<\/strong><\/em><\/p>\n<ul>\n<li><span style=\"color: #0000ff\">text &#8211; the cell that contains the character you want to substitute<\/span><\/li>\n<li><span style=\"color: #ff0000\">old_text &#8211; the character you want to change<\/span><\/li>\n<li><span style=\"color: #339966\">new_text &#8211; the new character you want to place<\/span><\/li>\n<li><span style=\"color: #ff6600\">[instance num] &#8211; the occurrence of the old text you want to replace<\/span><\/li>\n<\/ul>\n<hr \/>\n<p>&nbsp;<\/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<p>Watch it on <a href=\"https:\/\/youtu.be\/HSx4rz9cNOo\" target=\"_blank\" rel=\"nofollow noopener\"><strong>YouTube<\/strong><\/a> and give it a thumbs-up!<\/p>\n<div class=\"after-post-box\">\n<p><iframe src=\"https:\/\/www.youtube.com\/embed\/HSx4rz9cNOo?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>Follow the<strong>\u00a0step-by-step tutorial<\/strong> on How to Remove Dashes in Excel and <strong>download this Excel workbook<\/strong>\u00a0to practice along:<\/p>\n<div class=\"after-post-box\">\n<p class=\"line-two\"><a class=\"IRPP_minimalist icon-download button small\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-2.xlsx\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-2.xlsx\" data-leadbox-id=\"147284833f72a2:12f08263ab46dc\"><span class=\"ctaText px-3 text-capitalize\"><strong>download excel workbook<\/strong><i class=\"fa fa-download\"><\/i><\/span><span class=\"postTitle px-3\">SUBSTITUTE-Remove-second-hyphen-2.xlsx<\/span><\/a><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p class=\"line-two\">In our example below, we have a list of\u00a0part numbers\u00a0and we want to remove the second dash<b>. <\/b>So, the part number C97-27-JT should be C97-27JT!<\/p>\n<\/div>\n<p><span style=\"color: #ff0000\"><strong>STEP 1:<\/strong> <\/span>We need to <strong>enter the <i>Substitute\u00a0<\/i>function <\/strong>next to the cell that we want to\u00a0clean\u00a0the data from:<\/p>\n<h3 style=\"text-align: center\"><span style=\"color: #0000ff\">=SUBSTITUTE<\/span><\/h3>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-01.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone size-full wp-image-5764\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-01.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"633\" height=\"176\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-01.png 633w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-01-300x83.png 300w\" sizes=\"(max-width: 633px) 100vw, 633px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000\"><strong>STEP 2:<\/strong><\/span> Enter the <strong>first argument<\/strong> of the SUBSTITUTE function: <em><strong><span style=\"color: #0000ff\">text<\/span><\/strong><\/em><\/p>\n<p><em>Which text\u00a0do we want to change?<\/em><\/p>\n<p>Reference the cell that contains the text or value:<\/p>\n<h3 style=\"text-align: center\"><span style=\"color: #000000\">=SUBSTITUTE<\/span><span style=\"color: #0000ff\">(C9,<\/span><\/h3>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-02.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone size-full wp-image-5765\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-02.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"558\" height=\"175\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-02.png 558w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-02-300x94.png 300w\" sizes=\"(max-width: 558px) 100vw, 558px\" \/><\/a><\/p>\n<p><strong><span style=\"color: #ff0000\">STEP 3:<\/span> <\/strong>Enter the <strong>second argument<\/strong> of the SUBSTITUTE function:\u00a0<em><strong><span style=\"color: #0000ff\">old_text<\/span><\/strong><\/em><\/p>\n<p><em>Which text\/characters do we want to replace?<\/em><\/p>\n<p>We want to remove the dash \u00a0<strong>&#8211;<\/strong> \u00a0so type it in with double quotations:<\/p>\n<h3 style=\"text-align: center\"><span style=\"color: #000000\">=SUBSTITUTE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(C9,<\/span> &#8220;-&#8220;,<\/span><\/h3>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-03.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone size-full wp-image-5766\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-03.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"555\" height=\"177\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-03.png 555w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-03-300x96.png 300w\" sizes=\"(max-width: 555px) 100vw, 555px\" \/><\/a><\/p>\n<p><strong><span style=\"color: #ff0000\">STEP 4:<\/span> <\/strong>Enter the <strong>third argument<\/strong> of the SUBSTITUTE function: <em><strong><span style=\"color: #0000ff\">new_text<\/span><\/strong><\/em><\/p>\n<p><em>Which text\/characters do we want to replace it with?<\/em><\/p>\n<p>We want to remove this, so just type in a blank value:<\/p>\n<h3 style=\"text-align: center\"><span style=\"color: #000000\">=SUBSTITUTE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(C9,<\/span> <span style=\"color: #000000\">&#8220;-&#8220;,<\/span>\u00a0,<\/span><\/h3>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-04.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone size-full wp-image-5767\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-04.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"551\" height=\"174\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-04.png 551w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-04-300x95.png 300w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><\/a><\/p>\n<p><strong><span style=\"color: #ff0000\">STEP 5:<\/span> <\/strong>Enter the<strong> fourth argument<\/strong> of the SUBSTITUTE function:\u00a0<em><strong><span style=\"color: #0000ff\">[instance num]<\/span><\/strong><\/em><\/p>\n<p><em>Which specific instance are we targeting the substitution on?<\/em><\/p>\n<p>This parameter is optional. \u00a0In our scenario, we only want the second dash to be removed.<\/p>\n<p>So place in the number <strong>2 <\/strong>(as it is the 2nd instance the dash is located):<\/p>\n<h3 style=\"text-align: center\"><span style=\"color: #000000\">=SUBSTITUTE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(C9,<\/span> <span style=\"color: #000000\">&#8220;-&#8220;,<\/span> <span style=\"color: #000000\">,<\/span> 2)<\/span><\/h3>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-05.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone size-full wp-image-5768\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-05.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"457\" height=\"178\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-05.png 457w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-05-300x117.png 300w\" sizes=\"(max-width: 457px) 100vw, 457px\" \/><\/a><\/p>\n<p>One thing you need to keep in mind is that if you <strong>ignore this argument<\/strong>, <strong>every occurrence of the old text will be changed<\/strong> to the next text.<\/p>\n<p>Let&#8217;s try it!<\/p>\n<h3 style=\"text-align: center\"><span style=\"color: #000000\">=SUBSTITUTE<\/span><span style=\"color: #0000ff\"><span style=\"color: #000000\">(C9,<\/span> <span style=\"color: #000000\">&#8220;-&#8220;,<\/span> <span style=\"color: #000000\">,<\/span><\/span>)<\/h3>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/Screenshot-284.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone size-full wp-image-22984\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/Screenshot-284.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"657\" height=\"247\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/Screenshot-284.png 657w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/Screenshot-284-300x113.png 300w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000\"><strong>STEP 6:<\/strong> <\/span>Do the same for the rest of the cells by dragging the <b>SUBSTITUTE\u00a0<\/b>formula all the way down using the left mouse button.<\/p>\n<p>Note that all of the parts\u00a0are now changed to your new part values:<\/p>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-06.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" class=\"alignnone wp-image-5769 size-full\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-06.png\" alt=\"Remove Second Hyphen with Excel&#039;s SUBSTITUTE Formula\" width=\"482\" height=\"200\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-06.png 482w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2017\/01\/SUBSTITUTE-Remove-second-hyphen-06-300x124.png 300w\" sizes=\"(max-width: 482px) 100vw, 482px\" \/><\/a><\/p>\n<p>In this way, you can easily <a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/remove-text-in-excel\/\" target=\"_blank\" rel=\"noopener\">remove<\/a> the 2nd occurrence of hyphens in Excel. This completes our tutorial on how to remove hyphen in Excel using the SUBSTITUTE function.<\/p>\n<p>Following the steps mentioned above, you can easily change the nth occurrence of an old text with a new one.<\/p>\n<p>&nbsp;<\/p>\n<p>Make sure to download our FREE PDF on the<strong><a href=\"https:\/\/app.monstercampaigns.com\/c\/czseo0viyrmspcx5ndve\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">\u00a0333 Excel keyboard Shortcuts here<\/a>:<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are times where I needed to remove the nth occurrence\u00a0from my text. \u00a0For example, I would like to how to remove dashes in Excel &#8211; it&#8217;s 2nd occurrence. Normally I would have to find the second hyphen, split the text based on the hyphen&#8217;s location, merge the remaining parts together&#8230;.pfff&#8230;.it&#8217;s just a headache and [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":17293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cos_headline_score":0,"cos_seo_score":0,"cos_headline_text":"Remove Second Hyphen with Excel's SUBSTITUTE Formula","cos_headline_has_been_analyzed":false,"cos_last_analyzed_headline":[],"om_disable_all_campaigns":false},"categories":[3,306,14],"tags":[142,222,174],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/5761"}],"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=5761"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/5761\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/17293"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=5761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=5761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=5761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}