+ Reply to Thread
Results 1 to 8 of 8

Function to Remove String Between 2 Characters

  1. #1
    Forum Contributor
    Join Date
    11-28-2005
    Location
    Dover, England
    MS-Off Ver
    365
    Posts
    172

    Function to Remove String Between 2 Characters

    I have the string similar to "12345_1_13" and I need to remove "_1" from the string to end up with "12345_13". I am really looking for a function to do this, but would settle for a formula. I thank you for your help.

  2. #2
    Forum Contributor amit.wilson's Avatar
    Join Date
    07-09-2013
    Location
    Gotham
    MS-Off Ver
    Excel for Mac 2011
    Posts
    283

    Re: Function to Remove String Between 2 Characters

    T,

    if the string always has the same length and the bit to be removed is always at the same place, you could try this.

    If this string is in cell A1:
    =LEFT(A1,5)&RIGHT(A1,3)
    Cheers
    <-- If you're happy & you know it...click the star.:-)

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,203

    Re: Function to Remove String Between 2 Characters

    Try ...

    =SUBSTITUTE(A1,"_1_","_")

  4. #4
    Forum Contributor
    Join Date
    11-28-2005
    Location
    Dover, England
    MS-Off Ver
    365
    Posts
    172

    Re: Function to Remove String Between 2 Characters

    Thank you for both responses. However, Amit the string length can vary between 5 and 7 characters from the left and 1-3 characters to the right and Phuocam, equally the same the "_1_" could be "_999_". Cheers

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Function to Remove String Between 2 Characters

    Perhaps

    =LEFT(A1,FIND("_",A1))&MID(A1,FIND("~",SUBSTITUTE(A1,"_","~",2))+1,LEN(A1))

  6. #6
    Forum Contributor
    Join Date
    11-28-2005
    Location
    Dover, England
    MS-Off Ver
    365
    Posts
    172

    Re: Function to Remove String Between 2 Characters

    Jindon-Pefect

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,203

    Re: Function to Remove String Between 2 Characters

    Or ...

    =REPLACE(A1,FIND("_",A1),FIND("_",A1,FIND("_",A1)+1)-FIND("_",A1),"")

  8. #8
    Forum Contributor
    Join Date
    09-18-2015
    Location
    Republic of Korea
    MS-Off Ver
    2010
    Posts
    314

    Re: Function to Remove String Between 2 Characters

    =left(a1,find("_",a1))&trim(right(substitute(a1,"_",rept(" ",50)),50))
    Last edited by chief_abound; 05-28-2016 at 09:47 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA to remove characters from a string
    By ed67 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2015, 12:46 PM
  2. [SOLVED] VBA, remove all characters within a string, except numerical characters and full stops
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-25-2015, 09:24 PM
  3. [SOLVED] VBA Remove First 10 Characters From string
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2013, 08:22 AM
  4. [SOLVED] Remove certain characters from the end of a string only
    By mini_dutch28 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-20-2012, 01:04 PM
  5. [SOLVED] How to remove string characters in a cell
    By itsmejan24 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-10-2012, 03:02 PM
  6. Remove characters in a string.
    By jncswe in forum Excel General
    Replies: 2
    Last Post: 09-10-2010, 07:26 AM
  7. Remove Characters From Right of String
    By milagros in forum Excel General
    Replies: 11
    Last Post: 12-26-2009, 12:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1