+ Reply to Thread
Results 1 to 11 of 11

Removing letters from text string

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Removing letters from text string

    Hi all, I have some text string's where i want to keep only the numbers and special characters. Not all the strings have letters but some do.

    An example is below

    5/1
    26/5
    69/10
    21/10F

    I would want these to show as

    5/1
    26/5
    69/10
    21/10 (so the F is removed).

    The letter (if there is one) will always be the last charterer if that helps?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Removing letters from text string

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Office 365
    Posts
    1,899

    Re: Removing letters from text string

    Hi,

    Providing a sample workbook with maximum cases to understand the data discipline .

    Punnam

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,466

    Re: Removing letters from text string

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



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    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 letters from text string

    Or this

    =IF(ISERROR(RIGHT(A1)+0),LEFT(A1,LEN(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

  6. #6
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Removing letters from text string

    Hi all, they work well when there is only one letter, but in some instances there are 2 letters at the end. Sorry for not clarifying this.

  7. #7
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Removing letters from text string

    With example attachment
    Attached Files Attached Files

  8. #8
    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 letters from text string

    This should do it

    =IFERROR(LEFT(A1,MATCH(1,(CODE(MID(A1,ROW($A$1:$A$255),1))<90)*(CODE(MID(A1,ROW($A$1:$A$255),1))>=65),0)-1),A1)

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    A
    B
    1
    11/4F 11/4
    2
    10/1 10/1
    3
    66/1 66/1
    4
    59/20 59/20
    5
    6/1 6/1
    6
    17/10JF 17/10
    7
    9/2 9/2
    8
    8/5F 8/5

  9. #9
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Removing letters from text string

    Thanks for your reply Alkey, was hoping to avoid array formula's if possible due to the additional memory and time taken to calculate. I have quite a few lines to work through so if possible was hoping the code would be standard formula type

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Removing letters from text string

    =LEFT(A1,MAX(INDEX(((CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))<65)+(CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))>90))*ROW(INDIRECT("1:"&LEN(A1))),0)))
    Try this
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  11. #11
    Forum Contributor
    Join Date
    04-21-2009
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    710

    Re: Removing letters from text string

    Thats great. Thanks alot

+ 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 letters from text & letters combination
    By benoj2005 in forum Excel General
    Replies: 5
    Last Post: 02-26-2014, 11:20 AM
  2. [SOLVED] extract text string when you only know the last three letters of that string
    By alison0edwards in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-12-2012, 01:20 PM
  3. Removing fixed text length from text string
    By grumpyguppy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2011, 02:17 AM
  4. Removing all text except numbers and letters
    By stoopkid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-04-2007, 11:25 PM
  5. Help w pulling alpha letters out of text string
    By BattleShip in forum Excel General
    Replies: 3
    Last Post: 01-18-2007, 03:26 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