+ Reply to Thread
Results 1 to 5 of 5

Remove first character from text string if it is an underscore

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    157

    Remove first character from text string if it is an underscore

    Hi, I have a list of thousands of Airports and some of them have an underscore before the name and in between the words.

    Is there anyway that I can remove ONLY the underscore BEFORE the text string?
    If there is an underscore inbetween words I need this to remain there.

    I think this should be able to be done with a formula? As I only need the first character removed from the text string if it is an underscore.

    Example of list:

    _Menorca_Airport
    San_Javier_Airport
    Palma_de_Mallorca_Airport
    Reus_Airport
    _Santander_Airport
    Santiago_de_Compostela_Airport
    Seville_Airport
    Tenerife_South_Airport
    _Valencia_Airport
    Valladolid_Airport
    Zaragoza_Airport


    Thanks in advance for your help!

    Alex
    If this answer helped you then could you please click "Add Reputation"

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

    Re: Remove first character from text string if it is an underscore

    With your sample list in A1:A11
    this regular formula, copied down, removes the leading underscore character
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    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: Remove first character from text string if it is an underscore

    or this

    =IF(LEFT(A1)="_",SUBSTITUTE(A1,"_","",1),A1)
    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

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Remove first character from text string if it is an underscore

    Moreover if you want to remove the first underscore, if any, in the original cells and don't want to extract the desired output in another column, try this code........

    Please Login or Register  to view this content.
    For detail see the attached sheet.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    157

    Re: Remove first character from text string if it is an underscore

    Thank you all for your help, each worked exactly as I wanted them to! And such quick responses as well, thanks again!

+ 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. Remove Last Character from String
    By SLP in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-03-2007, 05:17 PM
  2. Remove last character of text string
    By Grant in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-29-2005, 01:05 PM
  3. Replies: 5
    Last Post: 08-29-2005, 11:05 PM
  4. Replies: 1
    Last Post: 04-18-2005, 05:06 PM
  5. Replies: 1
    Last Post: 04-17-2005, 08:10 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