Location Data Knowledge Base

Data methodologies, and Release schedules.
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here

Finding the City based on a Zip Code

Alteryx Alumni (Retired)


I have a list of zip codes, can I use Alteryx to determine the city they're in?


The answer is yes! But with a few caveats. Zip Codes can be notoriously difficult to pair with cities they belong in because they exist in two forms; points and polygons. Point Zip Codes are generally associated with businesses or universities, while polygons generally encompass residential areas. Alteryx data does have Zip Codes with Points data; however, it is not immediately accessible and will require some configuration on the part of the user to get access to that level of data.


Zip Codes are also frequently adjusted, deprecated, and consolidated by the USPS, so depending on the age/vintage of the zip codes in your data as compared to that in the Alteryx Spatial Database, there may be some slight variation there as well. All said, users should still expect a reasonably high match rate. 


To start, make sure you either have the Alteryx Data Package installed (available with a license), or you have the 2010 US Census data installed (available for free at http://downloads.alteryx.com/data.html).


With the data installed, the first thing you will bring down is an Allocate Input Tool. Here you will choose the relevant dataset (Experian data or US Census) from the drop down, then check the box for Zip Codes under Pick Geography.


From here you will use the Join Tool to join your data to the Allocate Input data based on your Zip Code field and the Key field of the Allocate Input data. [NOTE: the Zip Code and Key fields will both need to be either String fields or numeric fields. Either is fine as long as it is consistent]


The resulting data that comes from the J output anchor of the Join tool will contain all of your Zip Codes that matched those in the dataset. The field "Name" that comes from the Allocate Input is formatted as the 5 digit Zip Code, followed by the City name. From here a simple Text to Columns tool configured to create 2 columns and parse on the space, will create a field specifically for the City and an extra Zip code field that can be deselected and discarded as the data moves down your workflow. 


See an example of the process in the attached workflow below.