+ Reply to Thread
Results 1 to 10 of 10

Remove before underscore Text from left or right in excel

Hybrid View

  1. #1
    Registered User
    Join Date
    01-29-2016
    Location
    india
    MS-Off Ver
    ms office 2013
    Posts
    40

    Remove before underscore Text from left or right in excel

    Hi

    I have file names in column with A123_STUV_XYX.pdf and some files name A567-XYZ_ABC.pdf .
    i want output STUV_XYZ.pdf and XYZ_ABD.pdf ,i tried with LEFT and FIND i did not getting desired out.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,936

    Re: Remove before underscore Text from left or right in excel

    If they file names always follow the same pattern and you want to remove the first 5 characters then you could use this:
    =RIGHT(A1,LEN(A1)-5)
    Change A1 to suit.

    If they are differing in format then you'll need to supply us with a larger sample.

    BSB

  3. #3
    Registered User
    Join Date
    01-29-2016
    Location
    india
    MS-Off Ver
    ms office 2013
    Posts
    40

    Re: Remove before underscore Text from left or right in excel

    Hi
    Thank you for your reply, Count starts from A01 to A10000 ,so first characters will be different.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,656

    Re: Remove before underscore Text from left or right in excel

    After that number, is there always either a dash or an underscore? What other permutations are there?

    I agree you need to provide a much bigger set of sample data.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    01-29-2016
    Location
    india
    MS-Off Ver
    ms office 2013
    Posts
    40

    Re: Remove before underscore Text from left or right in excel

    Hi

    this is the format how the file names are :

    A01_I T_04-06-2017_09-01-2018.pdf
    A02_I T_04-06-2018_09-01-2019.pdf
    ......
    A1001-I T_04-06-2016_09-01-2017.pdf
    ...
    A10000-I T_04-06-2014_09-01-2015.pdf

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,936

    Re: Remove before underscore Text from left or right in excel

    Then it could be as simple as:
    =RIGHT(A1,25)

    BSB

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,656

    Re: Remove before underscore Text from left or right in excel

    Or this:

    =MID(RIGHT(SUBSTITUTE(A1,"-","_"),100),FIND("_",RIGHT(SUBSTITUTE(A1,"-","_"),100))+1,100)

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,936

    Re: Remove before underscore Text from left or right in excel

    Or this:

    =IF(ISNUMBER(FIND("-",A1)),RIGHT(A1,LEN(A1)-FIND("-",A1)),RIGHT(A1,LEN(A1)-FIND("_",A1)))



    BSB

  9. #9
    Registered User
    Join Date
    01-29-2016
    Location
    india
    MS-Off Ver
    ms office 2013
    Posts
    40

    Re: Remove before underscore Text from left or right in excel

    tons of Thank you ,=MID(RIGHT(SUBSTITUTE(A1,"-","_"),100),FIND("_",RIGHT(SUBSTITUTE(A1,"-","_"),100))+1,100), it worked perfectly.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,656

    Re: Remove before underscore Text from left or right in excel

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 5
    Last Post: 10-27-2015, 06:49 PM
  2. Remove underscore when using named ranges for dynamic lists
    By stromley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-28-2015, 04:14 PM
  3. [SOLVED] Remove first character from text string if it is an underscore
    By alexander.small in forum Excel General
    Replies: 4
    Last Post: 05-13-2014, 04:13 AM
  4. [SOLVED] remove underscore if there is one
    By Hallet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2012, 11:59 AM
  5. remove underscore char (_) from entire worksheet
    By sdrgac in forum Excel General
    Replies: 3
    Last Post: 04-04-2012, 02:04 PM
  6. Remove left text string
    By Luc in Oxford in forum Excel General
    Replies: 2
    Last Post: 08-23-2005, 06:05 AM
  7. How do I remove all text to the left of the @ in an email address
    By David M in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-01-2005, 04:06 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