+ Reply to Thread
Results 1 to 6 of 6

Excel Formula to extract last digits from text string

  1. #1
    Registered User
    Join Date
    05-12-2017
    Location
    US
    MS-Off Ver
    2017
    Posts
    3

    Excel Formula to extract last digits from text string

    Hello,

    I am looking for an excel formula to extract the last digits from a text string.

    Example: RAC-170422242-OFFMAX105
    I would need to extract 105 from that string.

    It's not always the last 3 characters that i need. Sometimes the string can look like this:

    RADF-36564-WAL24

    In this case I need to extract 24 from that string

    Any help would be much appreciated.

    Thanks

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Excel Formula to extract last digits from text string

    Based on your very small sample, this is all I can come up with

    Please Login or Register  to view this content.
    B1 copied down >> =RIGHT(A1,LEN(MID(A1,FIND("@",SUBSTITUTE(A1,"-","@",2))+1,LEN(A1)))-MIN(FIND({0,1,2,3,4,5,6,7,8,9},MID(A1,FIND("@",SUBSTITUTE(A1,"-","@",2))+1,LEN(A1))&"0123456789"))+1)
    HTH
    Regards, Jeff

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,640

    Re: Excel Formula to extract last digits from text string

    A1 is string, Try:

    =MAX(IFERROR(--RIGHT(A1,ROW(INDIRECT("1:"&LEN(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.
    Quang PT

  4. #4
    Registered User
    Join Date
    05-12-2017
    Location
    US
    MS-Off Ver
    2017
    Posts
    3

    Re: Excel Formula to extract last digits from text string

    They both seem to work great. Thank you very much

  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: Excel Formula to extract last digits from text string

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

    v A B
    1 RAC-170422242-OFFMAX105 105
    2 RADF-36564-WAL24 24
    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
    Registered User
    Join Date
    05-12-2017
    Location
    US
    MS-Off Ver
    2017
    Posts
    3

    Re: Excel Formula to extract last digits from text string

    Really good one. Works like a charm. I changed the Row part to ROW(A$1:A$4) since there will never be more than 4 digits at the end. Thank you

+ 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] UDF to extract digits from variable range string
    By Excel2010101 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-28-2014, 03:41 PM
  2. Replies: 14
    Last Post: 03-08-2014, 03:25 PM
  3. [SOLVED] How to extract digits from a string?
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2013, 09:28 AM
  4. [SOLVED] Extract text from a string of text (amend formula to include new criteria)
    By robertguy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-10-2013, 04:53 PM
  5. [SOLVED] Excel 2007 : Extract last four digits from alphanumberical string
    By questionguy in forum Excel General
    Replies: 5
    Last Post: 07-16-2012, 12:51 PM
  6. Replies: 11
    Last Post: 11-16-2011, 12:56 PM
  7. Formula to extract digits from a text string?
    By Hash@example.org in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-15-2006, 12:16 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