+ Reply to Thread
Results 1 to 10 of 10

Simple text and number extraction

  1. #1
    Registered User
    Join Date
    09-10-2010
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    29

    Simple text and number extraction

    I have data in a string that vary from one letter and one number e.g. B9 to two letters and five numbers e.g. YF67543.

    I wish to put the letter component into one cell and the number element into another. Can anyone advise what the formula for this would be please?

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

    Re: Simple text and number extraction

    In Cell C9 use this..
    =IFERROR(LOOKUP(99^99,--(MID(SUBSTITUTE(B9," ",""),MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},SUBSTITUTE(B9," ","")&"0123456789")),ROW($1:$10000)))),"")
    This will extract the number portion

    In D9 use
    =Substitute(B9,C9,"")
    This will extract the text portion
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Simple text and number extraction

    If you will ONLY have 1 or 2 letters at the start, try this...
    =LEFT(B9,IF(ISNUMBER(MID(B9,2,1)*1),1,2))
    then use Ace's slick lil formula for the numbers
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simple text and number extraction

    Will the number ever start with a zero?

    B0

    YF00003
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Simple text and number extraction

    With Ace's substitute, it wont matter Biff

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simple text and number extraction

    If the numbers will never have leading zeros then we can use this much shorter formula:

    Data Range
    A B C
    1 B2 B 2
    2 C123 C 123
    3 FG45 FG 45
    4 XX12345 XX 12345
    5 DD9 DD 9

    This formula entered in B1:

    =SUBSTITUTE(A1,C1,"")

    This formula entered in C1:

    =-LOOKUP(0,-RIGHT(A1,{1,2,3,4,5}))

    Select B1:C1 and copy down as needed.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Simple text and number extraction

    hehe you are having way too much fun with those tables now Biff

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simple text and number extraction

    Love those tables!

    Very useful tool.

  9. #9
    Registered User
    Join Date
    09-10-2010
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Simple text and number extraction

    Hi guys,

    Thanks for this. No the numbers will never start with a zero.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Simple text and number extraction

    You're welcome. Thanks for the feedback!

+ 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. SIMPLE data extraction form Column A to B
    By mecutemecute in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-15-2013, 10:09 AM
  2. SIMPLE Data Extraction help
    By mecutemecute in forum Excel General
    Replies: 2
    Last Post: 05-15-2013, 09:35 AM
  3. simple data extraction
    By mecutemecute in forum Excel General
    Replies: 4
    Last Post: 05-15-2013, 09:33 AM
  4. [SOLVED] Simple question: Switching text if a number are higher than another.
    By orjanmen in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-10-2013, 02:48 PM
  5. Number Extraction
    By armansoor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2011, 04:03 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