Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to move data from two of our old systems into a new system. Problem is, somewhere along the line the 'state' column of our DB was corrupted. I have a column of ZIP codes I need to determine to state from. I've found a number of solutions for Excel, but they don't seem to play nicely with OpenOffice. I'm fairly certain there's a way to do it with the CSV from here but I'm not really sure where to start. Any ideas?

share|improve this question
up vote 1 down vote accepted

This is quite the long way around, but it worked for what I needed. Hopefully someone else can use this info. I could have used additional OR statements for some of the states, but it was easier for me to lay out my dataset without it.

I had this all as one single formula, but it was much too long for OO's tastes, so I had to split it up into 4 formulas, paste the formulas into 4 columns, create a 5th column that concatenates the first 4, then paste the values only from the 5th column into the original 'state' column.


The concatenate formula is simply =CONCATENATE(T3;U3;V3;W3)

Hopefully this question will save someone else some time.

share|improve this answer
for the record, you are using a spreadsheet, not a database (you refer to a DB in your original question) – horatio Oct 27 '11 at 20:52
No, I used a CSV dump of the database in question to rebuild a few corrupted columns. I edited the CSV in OpenOffice, added these formulas to a series of new columns, pasted the values that resulted into the original state column, deleted the formula columns, saved out the CSV again, and imported back into the DB. – SickHippie Nov 2 '11 at 4:26

In the short term, you could import a fresh and updated listing of zip codes to States using a qualified source such as the Center for Medicare and Medicare Services. This is oriented to payer data, and is actively maintained. After that you could use a Pivot Table or handle the work through Open Office Base, and some SQL join magic to create a view that you could dump out to Calc or a CSV. What type of DB is behind your system? What type of import facility is available?

Another free tool would be to use Quest TOAD for DA Freeware to join the tables. This is very user friendly option with a small learning curve. If you find yourself doing data plumbing/reporting, this is a very nice tool, and worth the cost of a license.

Browse to

Download the following zip archive: Zip Code to Carrier Locality File [ZIP, 4.08MB] - Updated 8/17/11

share|improve this answer

I haven't looked at the ZIP Code CSV, but I'm fairly certain you can use a VLOOKUP() formula that looks through that data.

=VLOOKUP(zipcode,csvdata,column number for state relative to zip in csvdata,FALSE)
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .