This is part of the Step by Step Guides to get started with some of the more complex topics on this site. The full story on geocoding can be found in Complete Excel Address Data with Google Mapping API.


What you need

GoogleMapping.xlsm from the Download Complete Projects page



To take a set of addresses in Excel and find their latitude and longitude



All Mapping activities, of which geocoding is the simplest, are controlled by 2 parameter sheets. One is general, and tells the procedures how to deal with the data returned from the various mapping providers (geoCodingParameters worksheet) and the other is specific to particular sets of data or desired results (in this case ‘step by step parameters’)

  • Go to the step by Step MasterTab. This is where you enter the data to be geoCoded. You’ll find some example data that looks like this. The columns in Yellow need to be filled in with your data. Hitting the ‘geoCode’ button will cause the brown columns to be populated

  • There are no more steps. That’s all there is to it.


What just happened ?

Each address was sent to the Google Maps API, and was decoded according the rules in geoCodingParameters sheet. The brown columns of the ‘Step By Step Master’ sheet were populated according to the rules in the ‘step by step parameters’ sheet. As we move on to more complex examples we will dig in to the contents of these.

VBA code

The code associated with the geoCode button can be found in the GoogleMap module, and looks like this.

<br> Public Sub stepByStepgeoCoding()<br> googleMappingExample "Step by Step Parameters"<br> End Sub<br>

What Next

Read more about the detail of how all this works and walk through the source code at GeoCoding or see some more Step by Step Guides (see below for further reading).

In the meantime why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.

More Step by Step Guides