Tuesday, October 9, 2012

yogi_Extract 'Pick-up at' And 'Deliver to' ZipCodes From Text In Column A For Specified Conditions

Yogi Anand, D.Eng, P.E.      Google Spreadsheet   Post  #798  Oct 09, 2012    www.energyefficientbuild.com.

user Tjennings said: (http://productforums.google.com/forum/?zx=j1qokp4rhrrx#!category-topic/docs/spreadsheets/nVUXQPbWT4g)
Extract two zip codes from one cell with lots of mixed content (html, text and numbers) 

I have an RSS feed inserting html, text and numbers all into one Column M.  
I need to extract the first two zip codes from this large cell.

The best way to identify the numbers is that there is always an exact phrase before each zip "Pick-up at: random city(length varies)", "random state(always two capital letters) 5digitzipcode" 
Example as follows "Pick-up at: MILSFORD, OH 45150<BR>"
There is always one space before the zipcode and always <BR> immediately behind the number.


The second 5 digit zipcode always has the statement "Deliver to: "random city(length varies)", "random state(always two capital letters)5 digit number"
Example as follows: "Deliver to: WAUSEONENASSA, TN 43582<BR>"
There are other sets of 5 digit numbers in the same cell but none will have the exact identifiers descried above.

I am more familiar with excel and had this working there but due to other excel limitations I have started using google docs and am excited to see all the new possibilities!!! 
Your help is greatly appreciated.
----------------------------------------------------------------------------------------------------
following is a solution to the problem:

2 comments:

  1. Hi thank you for your quick response the code is not working yet. It gave me a circular reference so I moved it to an adjacent column but then it provided random references.

    ReplyDelete
  2. Hi tjennings:

    For the data you had posted the solution I have provided works for me ... I know you have now provided an image of the new data -- please post the actual data and not just an image of the new data or share your spreadsheet along with your expected result and then let us take it from there.

    Cheers!
    Yogi
    Cloud Computing -- Google Docs Way
    yogi--anand-consulting.blogspot.com

    ReplyDelete