+ Reply to Thread
Results 1 to 5 of 5

Extracting a portion of text string from a cell

  1. #1
    Registered User
    Join Date
    05-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    Extracting a portion of text string from a cell

    Help!

    I need to extract the first letter 'N' followed by the numbers until the next any letter or blank in a string in a cell. EG

    C5N6 ------------ N6
    C5N6R1R2 ------- N6
    C5N6R1 --------- N6
    C5N15 ---------- N15
    C5N11R1R2R3 -----N11

    Can this be done using formulas and functions?

    Thx

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Extracting a portion of text string from a cell

    Try

    ="N"&LOOKUP(99^99,--("0"&MID(RIGHT(A1,LEN(A1)-FIND("N",A1)),MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},RIGHT(A1,LEN(A1)-FIND("N",A1))&"0123456789")),ROW($1:$10000))))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extracting a portion of text string from a cell

    Or this array formula:

    =MID(A1,FIND("N",A1),IFERROR(MATCH(FALSE,ISNUMBER(--(MID(A1,FIND("N",A1)+1,ROW(INDIRECT("1:"&(LEN(A1)-FIND("N",A1))))))),0),LEN(A1)-FIND("N",A1)))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Registered User
    Join Date
    05-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    Cool Re: Extracting a portion of text string from a cell

    Thank you so much, it works

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Extracting a portion of text string from a cell

    If what you posted is a consistent sample of your data...

    Then can we assume the string you're looking for is always :
    1. Beginning at the 3rd character position
    2. Followed by "R" or Nothing

    If yes to both, then try

    =REPLACE(LEFT(A1,FIND("R",A1&"R")-1),1,2,"")

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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