Choosing the Right Function to Calculate Distance

CDXZipStream, our Microsoft Excel add-in for location and zip code analysis, has multiple functions that can calculate geographical distance between zip codes, points of latitude and longitude, and address locations.  Here’s a guide that can help you decide which function is right for your particular application.

First, let’s clarify what we mean by distance.  The distance between two geographic points can be either straight-line or driving distance.  Straight-line (also called geodesic, or “as the crow flies”) distance is simply the shortest distance between two locations, accounting only for the curvature of the earth.  Driving distance, however, follows established roads and represents the distance a motor vehicle would need to travel between two locations.  

The distance-calculating functions of CDXZipStream are:

CDXDistance calculates straight-line distance between U.S. ZIP codes.  Just input two ZIP codes and specify the output in either miles or kilometers as shown below:  

The following formula is returned to the worksheet, showing the value of the distance in miles:

=CDXDistance("07005","07876")    Distance value shown =  13.25 (miles)

This formula can then be copied to a list of ZIP code pairs to calculate distances for large data sets.

The function CDXRadius also uses straight-line distance to find ZIP codes within a radius distance of a target ZIP.  The output data for this function includes both a list of ZIP codes and their distance from the target.  (CDXRadius also has the option of using a database of Canadian postal codes for performing this radius analysis.)  CDXRadius is shown in the video below:

or alternatively on Youtube: “Find ZIP Codes in a Radius Using Excel”. 

Both CDXDistance and CDXRadius are in the Lite and Basic Versions of CDXZipStream.  
 
CDXDistance2WP calculates the straight-line distance between two points of latitude and longitude.  In this case the input is:
 

Again, the resulting formula can be copied to a list of latitude and longitude points to calculate distance for large data sets.  CDXDistance 2WP is in the MapPoint and Basic versions of CDXZipStream.  It also requires separate purchase and installation of Microsoft MapPoint.

CDXRouteMP calculates driving distance, either between actual addresses or points of latitude and longitude; either can be used as input to this function.  CDXRouteMP also include various settings that can influence the route taken and thus the actual distance traveled.   These include road and route preference settings, that may favor routes on highways for instance, or non-toll roads.   Please refer to the video below for more information:

or the video on Youtube: "Driving Distance Calculator in Excel".  

CDXDistance 2WP is also in the MapPoint and Basic versions of CDXZipStream, and requires separate purchase and installation of Microsoft MapPoint.  

For a complete listing of CDXZipStream versions and the functionality associated with each, please refer to the version comparison chart on our website.

It may also be advantageous to use a combination of straight-line and driving distance functions when dealing with a large amount of data.   For example, straight-line distance calculations, which are generally much faster than driving distance calculations, can be used to narrow down a list of locations within a radius of a target location; the final list of locations can then be refined using driving distance alone.  For a more detailed discussion of how to use this approach, see our previous blog article “How to Find ZIP Codes within a Target Radius”.

Comments are closed