Postcode finder

Now that you have the G_LATLNG function for your Excel sheets, what is that good for? Well you can use your geocoded value to display your location on a map. I’ll get to that later on, but for now you can also use it to look up postcodes, thanks to a file I obtained from Nearby.org. I’ve repackaged it here along with a function which will tell you what postcode area a given latitude/longitude pair lies in.

The postcode data given excludes the final two letters – just returning SW8 1, not SW8 1XX for example. I can’t guarantee that it will get it right every time. The calculation just tells you which is the closest centre point of a postcode area, so oddly-shaped areas may turn up some errors. I’ve been using it for running through a large dataset and sorting for particular London Boroughs though, and it seems pretty effective for that task.

The file attached contains the postcode data as well as the demo table shown above. The UDF called POSTCODE is also in there if you want to use it in your own spreadsheets.

Download Geocoder and postcode finder.

5 Responses to Postcode finder

  1. sean says:

    File is not downloading. invalid link.

  2. slava says:

    Great stuff.
    Just a question to the author.
    How can i sort a list of geocoded uk addresses by nearest to a specific address?
    Thanks a lot.

    • Jamie Bull says:

      Hi Slava,

      There’s another post on the site which has a bit of code to find distance (by road) between two locations and it accepts postcodes as inputs. Alternatively if you want to know the distance as the crow flies there’s a function to calculate Great Circle distance here.

      • slava says:

        dear Jamie Bull
        the idea of Postcode finder is really great.
        well done
        i have a question to you
        - in your example you said
        The postcode data given excludes the final two letters – just returning SW8 1, not SW8 1XX for example.
        -is there any chances to get the full postcode if i add the complete address like number and street and the name of city or town, and country.
        i want to get the postcode of london addresses having just number, street, area.
        thanks a lot

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>