+ Reply to Thread
Results 1 to 8 of 8

Extracting Data in Multiple Cells

  1. #1
    Registered User
    Join Date
    08-17-2008
    Location
    LA
    Posts
    22

    Extracting Data in Multiple Cells

    Hello All,

    I have a question that I am not sure if it can be solved or not by a formula.

    My data set looks like this

    123 Street Fake Town, CA 12345
    Mr. Bob 456 Road Town, PA 10213
    456 Blvd City, FL 12032
    Mr. Smith 1231 Ave Village, NY 102021234

    What I need to do is in the last column, show just the zip code

    Final Data set looks like this.

    123 Street Fake Town, CA 12345 12345
    Mr. Bob 456 Road Town, PA 10213 10213
    456 Blvd City, FL 12032 12032
    Mr. Smith 1231 Ave Village, NY 102021234 102021234

    Any recommendations?



    Thank you for all the responses below. As I started working on my data, I was wondering if the following was possible as well?

    Finished Data Set
    123 Street Fake Town, CA 12345
    Mr. Bob 456 Road Town, PA 10213
    456 Blvd City, FL 12032
    Mr. Smith 1231 Ave Village, NY 102021234
    Last edited by jdot; 03-21-2012 at 01:55 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Extracting Data in Multiple Cells

    Try this user defined function

    Please Login or Register  to view this content.
    Switch to the VBA editor (Alt F11), Insert a new module (Insert- Module) and paste in the above. Alt F11 back to worksheet.

    In A4 type =GetZipCode(A1:C1) and copy down.
    Martin

  3. #3
    Valued Forum Contributor
    Join Date
    03-14-2012
    Location
    Arizona USA
    MS-Off Ver
    Excel 2000/2007
    Posts
    408

    Re: Extracting Data in Multiple Cells

    Just merge all the strings together then do the following;
    1. Check for 9 numeric digits on the right side of the merged string. If there are 9 numeric digits on the right side, that is the zip+4.
    2. If there was not 9 numeric digits on the right side, check for 5 numeric digits on the right side. If there are 5 numeric digits on the right side, that is the zip.

    If neither test passes, there is no recognized zip present.

    Coding like this

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Extracting Data in Multiple Cells

    Assume the data is in A1:C1, in D1

    =TRIM(RIGHT(SUBSTITUTE(LOOKUP(2,1/(A1:C1<>""),A1:C1)," ",REPT(" ",20)),20))

    copy down.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Extracting Data in Multiple Cells

    Hello
    I used formula's here.with a helper column..
    If this is applicable..

    extractdata.xlsx

    HTH
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Extracting Data in Multiple Cells

    Hello jdot,

    Here is another formula you can use. This will work as long as there are numbers present in the cell. If no numbers are found then you will see #VALUE in the cell. This formula assumes cell with the Zip code in is column "C".
    =RIGHT(C1,LEN(C1)-SMALL(IF(ISERROR(SEARCH({0,1,2,3,4,5,6,7,8,9},C1)),256,SEARCH({0,1,2,3,4,5,6,7,8,9},C1)),1)+1)
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    08-17-2008
    Location
    LA
    Posts
    22

    Re: Extracting Data in Multiple Cells

    thank you everyone for your help! you just saved me so much time!!!!

  8. #8
    Registered User
    Join Date
    08-17-2008
    Location
    LA
    Posts
    22

    Re: Extracting Data in Multiple Cells

    thanks everyone! i made a small update to my question and was hoping to get some more assistance! really appreciate the help!

+ 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