Hi,
I have a series of Data which has a complete address. I need to extract the Zip code from these addresses.
Thank you very much.
Greshan (Drgre)
Hi,
I have a series of Data which has a complete address. I need to extract the Zip code from these addresses.
Thank you very much.
Greshan (Drgre)
Hi.
In all of your examples, the string ends in "##### USA", where "#####" is the ZIP code. I presume, then, that this is always the case (otherwise you would surely have given some examples of different layouts)?
Regards
Yes. All the addresses has the below in common
"State Prefix" "Zip Code" "USA"
EG: RI 02914 USA
Thanks.
=LEFT(RIGHT(A1,9),5)
Or, if you need the result to be a numeric:
=0+LEFT(RIGHT(A1,9),5)
Regards
Hi Drgre,
Here is a Control+Shift+Enter (CSE) array formula that will do what you need.
=MAX(IFERROR(MID(A1,ROW(A1:A80),7)+0,""))
See the attached.
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
Not sure I understand, Marvin. The OP already confirmed that the format was fixed and identical for each string. Hence we can simply locate the ZIP code in the same place it will always be.
Besides, what happens if there's another, larger number in the address somewhere? Granted, unlikely. But impossible?
Or what does your formula return for e.g.:
41 January Street, FLUSHING, NY 11355 USA
?
Regards
Thank you very much XOR LX & MarvinP.
I got the formula from XOR LX. But i was not able to figure out MarvinP's formula as it give "#Value" error.
As usual you guys have being very helpful.
(Unfortunately I don't know how to close this post, Can you guys help me on that as well)
Hey Xor LX,
The formula looks down the string for 7 characters in a row that are completely numbers. My assumption is that there is a space in front and behind the 5 digit Zip code. I could have keyed on the "USA" but just wanted to show a different method. Here is another way using strings and now the "USA"
=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)*(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-1),LEN(A1)))
After putting my formulas into the cell, instead of pressing enter, you need to hold the Control and Shift keys down and then press Enter. This makes it an Array Formula.
To tag this thread as "Solved" you need to EDIT your original post, click on "Go Advanced" and change the prefix of the thread to "Solved".
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks