+ Reply to Thread
Results 1 to 6 of 6

Tricky Extraction Problem

  1. #1
    Registered User
    Join Date
    05-23-2006
    Posts
    58

    Exclamation Tricky Extraction Problem

    I have a list of businesses in Excel, but all the data for each business is in one cell. For example:

    "Best Western Hospitality House Motel 532 N Market Street Redding CA 96003-3610"

    "Comfort Suites San Clemente 3701 South El Camino Real San Clemente CA 92672"

    I want to split the data into separate cells:
    Business Name, Address, City, State, Zip Code should each be extracted to a separate cell.


    Any suggestions on how to do this? Also, I would like to remove the remove the name of the city from the name of the business if it is there. For example, I would like "Comfort Suites" for business name, not "Comfort Suites San Clemente"

    Thanks in advance.

  2. #2
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by Spreadsheet
    I have a list of businesses in Excel, but all the data for each business is in one cell. For example:

    "Best Western Hospitality House Motel 532 N Market Street Redding CA 96003-3610"

    "Comfort Suites San Clemente 3701 South El Camino Real San Clemente CA 92672"

    I want to split the data into separate cells:
    Business Name, Address, City, State, Zip Code should each be extracted to a separate cell.


    Any suggestions on how to do this? Also, I would like to remove the remove the name of the city from the name of the business if it is there. For example, I would like "Comfort Suites" for business name, not "Comfort Suites San Clemente"

    Thanks in advance.

    Based on what you have, the State and Zip Code will be fairly easy. The rest is going to be rather difficult. (I'm assuming all Zip Codes are similiar to your examples and don't have any spaces in them instead of dashes)

    For the Zip Code, use:
    =RIGHT(A1,LEN(A1)-FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

    For the State, use: (I'm assuming they're all 2 characters)
    =MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-1))+1,2)

    The problem for the rest is without you deciding for each line, it's hard to determine in a function where the name ends and the address begins, and the address ends and the city begins. (In your examples, the city is one word in the first one, but two words in the second)

    It is possible to split the entire string out so that each word is in one column, if that would make things any easier for you.

    You can do this by highlighting the column, choosing Data -> Text to Columns ...
    Choose Delimited and Next. Choose Space as your delimiter and hit Next. I'd then highlight every column (you can do this by choosing the first column, then holding down Shift and choosing the last column) and change the Column data format to Text. Choose the Destination (by default it overwrites your original column). Hit Finish.

    Sorry I can't help you much more than that.

    Scott

  3. #3
    Registered User
    Join Date
    05-23-2006
    Posts
    58

    so far so good

    Thanks Scott. The Zipcode and State have been extracted nicely. Is there not any way to extract every thing from the cell that occurs before the first number? This would enable extraction of the business name.

  4. #4
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by Spreadsheet
    Thanks Scott. The Zipcode and State have been extracted nicely. Is there not any way to extract every thing from the cell that occurs before the first number? This would enable extraction of the business name.
    The best I can give you is the following:

    =LEFT(A1,MIN(IF(ISERROR(FIND(RIGHT(ROW(A1:A10),1),A1)),"",FIND(RIGHT(ROW(A1:A10),1),A1)))-2)
    Entered with CTRL+SHIFT+ENTER.

    To get the position of the first number, it's just:
    =MIN(IF(ISERROR(FIND(RIGHT(ROW(A1:A10),1),A1)),"",FIND(RIGHT(ROW(A1:A10),1),A1)))
    Entered with CTRL+SHIFT+ENTER.

    Hope that helps,
    Scott

  5. #5
    Registered User
    Join Date
    05-23-2006
    Posts
    58
    Thanks Scott,

    That did work - except for businesses with numbers in their name.

  6. #6
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi Spreadsheet

    You're not going to get any closer than Maistrye's answer gets you. Just get used to the fact that if a business name has a number in it you'll have to do it manually.

    DominicB

+ 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