How to add county and FIPS codes to a list of ZIP codes in Excel or Google Sheets
To add county names and FIPS codes to a column of ZIP codes, load a ZIP-to-county reference List on a second sheet and use XLOOKUP (or VLOOKUP) keyed on the 5-digit zip_code to pull primary_county and county_fips into your table. It is one formula, filled down — no add-in, no API, no macro.
Download the free 100-row ZIP sample.
See the columns and join keys before you buy — no account needed.
This walks through both the formula and the two things that quietly break it: ZIP codes losing their leading zeros, and ZIPs that cross more than one county.
What you need
- Your data: a column of 5-digit ZIP codes. That is the whole input.
- A reference List: a ZIP-to-place table with, at minimum,
zip_code,primary_county, andcounty_fips. The ZIP Code List with Coordinates carries all three (plusprimary_city,fips_place_code,lat, andlng) for 33,799 rows in one CSV. - The join key: the 5-digit
zip_code, matched exactly as text.
County FIPS and place FIPS are not the same code. county_fips is 5 digits and identifies the county; fips_place_code is 7 digits and identifies a city or town. This how-to attaches the county FIPS — the 5-digit one.
Step by step
- Put your ZIP codes in column A of a sheet, with a header like
zipin A1. - Open the reference List CSV and copy it onto a second sheet named
zips. - Confirm both ZIP columns are stored as text, not numbers (see the leading-zeros note below).
- In B2 of your first sheet, add the county name with an XLOOKUP against the reference List.
- In C2, do the same for the 5-digit
county_fips. - Select B2:C2 and fill down to the bottom of your ZIP column.
- Wrap each formula in
IFNA(...)so unmatched ZIPs readNot foundinstead of an error.
The formula (Excel or Google Sheets)
XLOOKUP is the clean version. In the reference sheet, say zip_code is column A, primary_county is column D, and county_fips is column E:
county name · 5-digit county FIPS
=XLOOKUP(A2, zips!$A:$A, zips!$D:$D) ' county name
=XLOOKUP(A2, zips!$A:$A, zips!$E:$E) ' 5-digit county FIPS
Fill down. To return both columns from one lookup and keep the FIPS text intact:
=IFNA(XLOOKUP($A2, zips!$A:$A, zips!$D:$E), "Not found")
If your Excel or Sheets version has no XLOOKUP, VLOOKUP does the same job — put the lookup column first and count columns to the right (here, county_fips is the 5th column of A:E):
=VLOOKUP(A2, zips!$A:$E, 4, FALSE) ' primary_county
=VLOOKUP(A2, zips!$A:$E, 5, FALSE) ' county_fips
The FALSE forces an exact match. Without it, VLOOKUP will silently return a near-miss.
Two things that break ZIP lookups
Leading zeros. ZIP codes like 07030 (Hoboken, NJ) or 02139 (Cambridge, MA) start with a zero. If either column is formatted as a number, Excel drops the zero, 07030 becomes 7030, and the match fails. Format both zip columns as Text before you paste, or coerce them in the key: =XLOOKUP(TEXT(A2,"00000"), zips!$A:$A, zips!$D:$D).
ZIPs that span counties. A single ZIP can cross a county line. A ZIP-to-primary-county table returns the county the ZIP mostly falls in — the right answer for most work, but not a claim that the ZIP sits entirely in one county. If your task needs every county a ZIP touches, a one-to-one lookup is the wrong tool; say so in your output rather than treating the primary county as exact.
Where the reference List comes from
The ZIP Code List with Coordinates ($29) is the reference file: one UTF-8 CSV, 33,799 rows, with zip_code, primary_city, primary_county, county_fips, fips_place_code, state_code, state_name, lat, and lng. It opens in Excel, Google Sheets, or pandas, and downloads instantly after checkout.
Checking one or two ZIPs by hand first? The ZIP code lookup tool returns the city, county, and FIPS for a single ZIP, free. And you can download the free 100-row sample of the full List to build and test your formula before you buy the whole file.
primary_county, county_fips, and fips_place_code are compiled from U.S. Census Bureau, HUD, and Department of the Interior releases and refresh as those publish. Where a List includes population, that figure is a 2024 estimate; Demographics-tier income and housing columns are 5-year averages — estimates, not exact counts.
Next: download the free 100-row ZIP sample to see the columns, or open the ZIP Code List with Coordinates ($29) for the full file.