+ Reply to Thread
Results 1 to 8 of 8

Delimiting to extract the last field from the right of string

  1. #1
    Forum Contributor
    Join Date
    04-19-2016
    Location
    Michigan
    MS-Off Ver
    15.0
    Posts
    130

    Delimiting to extract the last field from the right of string

    Good morning,

    I have strings with components separated by "-" and they have different numbers of these components, but I am most interested in the far right component.

    So for example:

    ABC-123-FG-34-GHJ-55
    ABF-12-FF-47
    HJG-92-BB-4B-88

    to be delimited to

    55
    47
    88

    Thanks!

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: Delimiting to extract the last field from the right of string

    Try this ...

    =TRIM(RIGHT(SUBSTITUTE(A1,"-",REPT(" ",255)),255))

    Or:

    =LOOKUP(10^11,-RIGHT(A1,{1,2,3,4,5,6,7,8,9,10}))

  3. #3
    Forum Contributor
    Join Date
    04-19-2016
    Location
    Michigan
    MS-Off Ver
    15.0
    Posts
    130

    Re: Delimiting to extract the last field from the right of string

    That was amazing... how?

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Delimiting to extract the last field from the right of string

    in your example right(a1,2) would work for all examples you have shown.

  5. #5
    Forum Contributor
    Join Date
    04-19-2016
    Location
    Michigan
    MS-Off Ver
    15.0
    Posts
    130

    Re: Delimiting to extract the last field from the right of string

    It did - I just don't understand how that formula works...

  6. #6
    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: Delimiting to extract the last field from the right of string

    Here is another one
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 ABC-123-FG-34-GHJ-55 55
    2 ABF-12-FF-47 47
    3 HJG-92-BB-4B-88 88
    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

  7. #7
    Forum Contributor
    Join Date
    04-19-2016
    Location
    Michigan
    MS-Off Ver
    15.0
    Posts
    130

    Re: Delimiting to extract the last field from the right of string

    Thanks so much!! I have another question

    How would I be able query the second to last element? So:

    ABC-123-FG-34-GHJ-55
    ABF-12-FF-47
    HJG-92-BB-4B-88

    Will yield:

    GHJ
    FF
    48

    Thanks!

  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: Delimiting to extract the last field from the right of string

    Try this
    Enter in B1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 ABC-123-FG-34-GHJ-55 GHJ
    2 ABF-12-FF-47 FF
    3 HJG-92-BB-4B-88 4B

+ 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] extract multi-letter string bits from string depending on size and case
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-18-2017, 10:41 PM
  2. Replies: 4
    Last Post: 10-25-2016, 04:45 PM
  3. Need to extract number string from a free text field
    By jyadayada in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-15-2016, 08:02 AM
  4. [SOLVED] Extract all the words from a string for processing, while leaving string intact.
    By staggers47 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-10-2014, 02:02 PM
  5. Extract a date from a field and append another field's data
    By Leroy221 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-07-2012, 11:35 AM
  6. [SOLVED] Extract a mainly numeric string (ISSN number) from an arbitrary string
    By Buzzed Aldrin in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-04-2012, 01:49 PM
  7. Extract sub-string of number from field of long series of numbers
    By ExcelExtrator in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-27-2005, 07:00 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