+ Reply to Thread
Results 1 to 12 of 12

Help with an extract string formula

  1. #1
    Forum Contributor
    Join Date
    01-14-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2010
    Posts
    194

    Help with an extract string formula

    Hello,

    I have data in this format,
    (aberdeen city, united kingdom)
    . What formula can I use to extract the data into two cells (A2 and A3 for instance)? It would look like this: A2: aberdeen city, A#: united kingdom. Sometimes they'll be data before (,) but it will always be in this format: (,)

    Thanks,

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help with an extract string formula

    Data > Text to columns ...
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Help with an extract string formula

    Try these:

    A2: =SUBSTITUTE(LEFT(A1,FIND(",",A1)-1),"(","")
    A3: =SUBSTITUTE(RIGHT(A1,LEN(A1)-FIND(",",A1)-1),")","")

    - Moo

  4. #4
    Forum Contributor
    Join Date
    01-14-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2010
    Posts
    194

    Re: Help with an extract string formula

    Moo,

    Thanks that's closer but that gave me New York, New York (in A2) and United States (in A3). In this case, of
    New York (New York, United States)
    how would I separate all three into different columns?

    Thanks,

    Matt
    Last edited by SEMMatt; 03-18-2015 at 10:04 AM. Reason: update

  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: Help with an extract string formula

    Use this formula in B1 and pull it to the right and then down

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(","&SUBSTITUTE($A1,"(",""),")",""),",",REPT(" ",125)),125*COLUMNS($A:A),125))

    Row\Col
    A
    B
    C
    1
    (aberdeen city, united kingdom) aberdeen city united kingdom
    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
    Forum Contributor
    Join Date
    01-14-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2010
    Posts
    194

    Re: Help with an extract string formula

    AlKey,

    Thank you but A1 will always be like this:
    New York (New York, United States)
    ?

  7. #7
    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: Help with an extract string formula

    Sorry, I overlooked that

    =TRIM(MID(SUBSTITUTE(","&SUBSTITUTE(REPLACE($A1,1,FIND("(",$A1),""),")",""),",",REPT(" ",125)),125*COLUMNS($A:A),125))

    Row\Col
    A
    B
    C
    1
    New York (New York, United States) New York United States

  8. #8
    Forum Contributor
    Join Date
    01-14-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2010
    Posts
    194

    Re: Help with an extract string formula

    AlKey, Perfect! Thanks

  9. #9
    Forum Contributor
    Join Date
    01-14-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2010
    Posts
    194

    Re: Help with an extract string formula

    AlKey, sorry to say but it wasn't quite perfect. I need it to be New York in column B and New York in column C. United States isn't important for this. Can you help please?

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

    Re: Help with an extract string formula

    How about in B1:

    =TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"(",REPT(" ",100)),",",REPT(" ",100)),")",""),100))

    C1:

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"(",REPT(" ",100)),",",REPT(" ",100)),")",""),100,100))

    D1:

    =TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,"(",REPT(" ",100)),",",REPT(" ",100)),")",""),100))
    Quang PT

  11. #11
    Forum Contributor
    Join Date
    01-14-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2010
    Posts
    194

    Re: Help with an extract string formula

    bingo! thank you bebo

  12. #12
    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: Help with an extract string formula

    Like this?

    in B1 and pull formula to the right

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(","&SUBSTITUTE($A1," (",","),")",""),",",REPT(" ",125)),125*COLUMNS($A:A),125))

    Row\Col
    A
    B
    C
    D
    1
    New York (New York, United States) New York New York United States

+ 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] MID formula to string extract
    By nur2544 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-09-2014, 02:01 PM
  2. [SOLVED] Looking for a formula to extract a tax id from a string
    By lychee in forum Excel General
    Replies: 13
    Last Post: 12-04-2013, 04:20 PM
  3. Formula to extract numbers from string
    By Ninja2k in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-04-2013, 11:53 AM
  4. [SOLVED] what formula can I use to extract certain words from a string?
    By djmatok in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-03-2013, 05:21 PM
  5. what formula to extract text from a long string?
    By SEMMatt in forum Excel General
    Replies: 5
    Last Post: 10-07-2012, 10:23 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