I have a CSV of thousands of zip codes and need to add the state data. I don't need cities, just states. Any ideas?


It isn't clear whether you are asking only about a data set that has ZIP code data matched against the relevant state, or whether you are also asking about how to do the matching from your own CSV file. Given the inclusion of the word "tool" in the subject line, I take it that you want both the data set and details of how to do the matching.

First, there is a Microsoft Excel workbook here that has the data that you need for the match. I haven't checked the sheet for accuracy but I'm assuming that it is correct.

If you do not have Microsoft Excel, you can open the worksheet using Open Office Calc, available here.

Note that the Excel worksheet to which I have provided a link actually contains macros. To do what you want, it is not necessary to use macros and you do not need to agree to the requests that you might get to "enable content", or "run macros".

The workbook includes a worksheet called "Zip Code Data". Column A of that worksheet contains the ZIP codes (in numerical format and without the leading zeroes) and column F provides the relevant state information. If you scroll down to row number 38140 you will be able to confirm, for example, that ZIP code 90210 is in California. To do the matching that you want, I suggest that you open your own CSV file using the same software (Excel or Open Office) as you use to open the data worksheet. You will than have to use the cell function called VLOOKUP to do the match. Almost any book on Excel or Open Office, and indeed many websites, will be able to explain the intricacies of using Excel and VLOOKUP if you are unsure how to proceed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.