+ Reply to Thread
Results 1 to 4 of 4

Extracting numbers and text from inconsistent text/number formatted string

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    2010
    Posts
    2

    Extracting numbers and text from inconsistent text/number formatted string

    Hi,

    I have large tables of numbers and text...the data tables contain different ranges of data as below

    12HN - two numbers followed by two characters
    732AD - three numbers followed by two characters
    5PX - one number followed by two characters
    3 - one number and no characters

    Is there formula method that just extracts the number and another to just extract the text?

    Been struggling using the below formula, it works until you get a '5PX' type format, instead of returning the number alone '5', it returns '5P'.

    =IF(LEFT(I913,2)>9,LEFT(I913,2),IF(LEFT(I913,2)<9,LEFT(I913,1),0))

    Many thanks

    Brandivil

  2. #2
    Valued Forum Contributor Dunc3142's Avatar
    Join Date
    09-05-2007
    Location
    Franklin OH
    MS-Off Ver
    2000 and 2007 and 2010 @ Home & Teach 2010
    Posts
    351

    Re: Extracting numbers and text from inconsistent text/number formatted string

    This method uses a formula and assumes that the numbers are always first. I know that it is not VBA but I thought it might work for you. You could hide the columns that actually extract the numbers and just show the results.
    Attached Files Attached Files
    Yes it will. we just have to figure out how...
    If I have helped you, PLEASE click the * and add to my Rep.
    Also, if the problem is SOLVED please mark it as so.

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

    Re: Extracting numbers and text from inconsistent text/number formatted string

    Try this:
    B1=LEFT(A1,MAX(IFERROR(SEARCH({0,1,2,3,4,5,6,7,8,9},A1),"")))
    Confirmed with holding both Ctrl-shift, then enter

    C1=SUBSTITUTE(A1,B1,"")
    Quang PT

  4. #4
    Registered User
    Join Date
    01-25-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    2010
    Posts
    2

    Re: Extracting numbers and text from inconsistent text/number formatted string

    Hi, perfect! both solutions work! how do I thank you?

    Rgds,
    Brandivil

+ 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