How to extract zip code from a 1 cell adress line?

T

Tippo22

Hi, I have been trying to extract zipcodes from a long 1 cell adress line,
but have yet to find the right way to do it, because the adresses are of
variable length.
The adresses are usually look like this:
Adress Number, Zipcode Cityname

I know that I somehow have to extract the last section of the cell, from the
second space from the right, but I have no idea of how to do it, can someone
please help?
 
A

ASA

Is the zip always proceeded by a comma? If so then Mid(cell,
find(",",cell)+2,5) assuming that your zip code is 5 digits long.

This finds the incidence of the first comma in your cell, then adds two
positions and gets the next 5 characters.
 
T

Tippo22

Thanks a lot, but what if there is two comma's in the adress? Is it possible
to find the first comma from the right, and then extract the zip from there?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top