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.