Back to PostGrid Verify in Excel
SheetXAI logo
PostGrid Verify logo
PostGrid Verify · Excel Guide

Look Up City and State From ZIP Codes in a Excel workbook

2026-05-14
5 min read

The Scenario

A field sales manager has an Excel workbook with 600 prospect rows. Every row has a ZIP code — nothing else. Someone on the data team built the original list from a ZIP code purchase and never appended city and state. The CRM import template requires all three fields. The export deadline to the CRM team is end of day.

The bad version:

  • You look up a free ZIP code database online, download it as a CSV, and try to do a VLOOKUP against it — but the downloaded file has a different column structure and some ZIP codes have leading zeros stripped.
  • You fix the leading zeros, redo the VLOOKUP, and realize that about 80 ZIP codes return multiple valid cities because they span city limits, and VLOOKUP just returns the first match.
  • You send what you have to the CRM team and note that the city column might be off for some rows, knowing that will come back to you later.

End of day is end of day, and this was supposed to take twenty minutes.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Excel workbook. It reads the ZIP codes, calls PostGrid Verify's city-state lookup, and writes the primary city and state abbreviation back to the right columns — handling leading zeros and multi-city ZIPs without a VLOOKUP or a downloaded reference file.

Pull PostGrid Verify quota data and paste used lookups, lookup limit, and remaining lookups into the API Usage sheet in row 2, columns A through C.

What You Get

  • Column B receives the primary city name for each ZIP code.
  • Column C receives the two-letter state abbreviation.
  • Leading zeros are preserved — PostGrid handles postal code formatting natively.
  • ZIP codes that return multiple valid cities get the primary accepted city name rather than an arbitrary first match.

What If the Data Is Not Quite Ready

Some ZIP codes are missing or malformed

For each ZIP code in column A, call PostGrid Verify's city-state lookup — skip rows where column A is blank or contains fewer than 5 digits, and write INVALID ZIP in column B for those rows. Write city into column B and state into column C for all valid rows.

ZIP codes are in column D instead of A and need to land in different columns

Read all postal codes in column D of the Prospects sheet and use PostGrid to look up valid city and state combinations — write every valid city back into column E and the state into column F of the same sheet. Skip any row where column D is blank.

Some rows already have city and state from a previous run

For each ZIP code in column A, call PostGrid Verify's city-state lookup — skip any row where columns B and C are both already populated. Write city into column B and state into column C for all remaining rows.

Full enrichment pass before CRM export

For each row in this workbook: first check whether the ZIP code in column A has 5 digits — if not, flag it with INVALID in column D. For all valid ZIP codes, call PostGrid city-state lookup and write the primary city into column B and state abbreviation into column C. Then check if city or state is blank after the lookup and flag those rows with LOOKUP FAILED in column D. Write the count of rows flagged INVALID and LOOKUP FAILED into cells E1 and E2 respectively.

One prompt handles validation, lookup, writeback, failure flagging, and a summary count — rather than a formula, a reference file, and a manual review step.

Try It

Get the 7-day free trial of SheetXAI and open your prospect or contact Excel workbook the next time you have a column of ZIP codes that need city and state appended, then ask it to run the lookup in one pass. For related workflows, see how to bulk-verify full addresses or clean manually entered address strings using PostGrid suggestions.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more