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.

Jamie Bull | jamiebull1@gmail.com

Related Posts

WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December […]

Just a quick post to point out a couple of really useful tools.The first is a web-based tool for finding weather files for a location of interest. It’s similar to the Excel EPW finder tool we created a few years back, but much more modern looking. It is however missing a few of the useful […]

Eppy is a really useful library which I’ve written about several times, since before I really had anything to offer in terms of contributing code. Over the past year or so though, I’ve started to contribute back some of the changes and additions I’ve made while using eppy on academic and commercial projects.This post is […]

5 Comments on “Postcode finder”

  • sean says:

    File is not downloading. invalid link.

  • 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 *