+ Reply to Thread
Results 1 to 5 of 5

Removing Characters from Right Until Certain Character

  1. #1
    Registered User
    Join Date
    01-13-2016
    Location
    New York, United States
    MS-Off Ver
    Windows 7
    Posts
    8

    Removing Characters from Right Until Certain Character

    I have a text string with multiple underscores "_". I want to remove the remaining text after that last underscore

    Ex.
    EKI_US_EN_ExcelForum_01132016_main1
    EKI_US_EN_ExcelForum_01132015_homepage

    Desired Output
    EKI_US_EN_ExcelForum_01132016
    EKI_US_EN_ExcelForum_01132015

    Thanks!

  2. #2
    Registered User
    Join Date
    02-09-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Removing Characters from Right Until Certain Character

    Try below formula (considering your text is on cell A1):

    =RIGHT(A1,LEN(A1)-FIND("^",SUBSTITUTE(A1,"_","^",LEN(A1)-LEN(SUBSTITUTE(A1,"_","")))))

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Removing Characters from Right Until Certain Character

    With your sample data in A1:A2
    A
    1
    EKI_US_EN_ExcelForum_01132016_main1
    2
    EKI_US_EN_ExcelForum_01132015_homepage

    These formulas return all of the left text up to the last underscore (but not including it)
    Please Login or Register  to view this content.
    These are the results:
    A
    B
    1
    EKI_US_EN_ExcelForum_01132016_main1
    EKI_US_EN_ExcelForum_01132016
    2
    EKI_US_EN_ExcelForum_01132015_homepage
    EKI_US_EN_ExcelForum_01132015


    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Removing Characters from Right Until Certain Character

    Or this

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Data Range
    A
    B
    1
    EKI_US_EN_ExcelForum_01132016_main1
    EKI_US_EN_ExcelForum_01132016
    2
    EKI_US_EN_ExcelForum_01132015_homepage
    EKI_US_EN_ExcelForum_01132015
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    01-13-2016
    Location
    New York, United States
    MS-Off Ver
    Windows 7
    Posts
    8

    Re: Removing Characters from Right Until Certain Character

    Ron/AlKey

    Awesome. Thanks! This worked out well. Didn't realize it would be this complex. Good to know different functions to get the same result. Still trying to understand excels many functions.

    Excelfandoo - your formula actually return the text string I wanted to remove. Definitely useful though.

    - James
    Last edited by jam_ran; 01-13-2016 at 12:22 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. [SOLVED] Removing Everything After a Character
    By afriedman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-09-2013, 01:46 AM
  2. removing a character from a cell
    By wstarkey in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-15-2012, 08:07 AM
  3. Removing Everything After Certain Character
    By rykermason in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-08-2010, 02:56 PM
  4. Removing character using Trim..
    By Jocote46 in forum Excel General
    Replies: 5
    Last Post: 05-13-2009, 01:57 PM
  5. Regarding character removing in cell
    By ramki in forum Excel General
    Replies: 3
    Last Post: 06-13-2008, 12:50 AM
  6. Bloating when removing $ character
    By Aeetes in forum Excel General
    Replies: 4
    Last Post: 01-25-2007, 12:29 PM
  7. Removing last character of cell
    By mira in forum Excel General
    Replies: 4
    Last Post: 07-27-2005, 03:05 PM
  8. [SOLVED] removing text after a character
    By Kim in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-18-2005, 10:06 AM

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