If VLOOKUP cannot find a ZIP code, first check whether the lookup value and the ZIP codes in your table are the same data type and have the same leading zeros. With ZIP codes in A2:A100, the values to return in B2:B100, and the code to search for in D2, use =VLOOKUP(D2,$A$2:$B$100,2,FALSE) for an exact match.
Why ZIP-code lookups are unusually easy to break
A ZIP code looks like a number, but it is an identifier, not a quantity. You do not add ZIP codes or measure how much larger one is than another. That difference matters in Excel: a cell containing the number 2108 is not necessarily the same value as a cell containing the text 02108. VLOOKUP compares stored values, not just what appears on the screen.
Leading zeros make the problem especially common with U.S. ZIP codes. When you type 02108 into a cell formatted as General, Excel normally interprets it as the number 2108 and drops the first zero. A text version of 02108 keeps that zero. The cells may look similar after formatting, yet the lookup can still fail because their underlying values differ.
There are other possible causes, too: the lookup column may not be the first column in the selected range, the return-column number may be wrong, or the formula may be using approximate matching. Checking these details in order is usually quicker than rewriting the whole lookup.
How VLOOKUP matches a value
VLOOKUP searches down the first column of a table range for the value you supply, then returns a value from another column in the same row. In the example formula, D2 is the search value, A2:A100 is the first column searched, and the number 2 tells Excel to return the second column of the selected range, B2:B100.
The final argument, FALSE, requests an exact match. For ZIP codes, that is nearly always the right choice. If you omit this argument, VLOOKUP uses approximate matching by default. Approximate matching is intended for ordered ranges such as tax brackets or grading bands, and it can return an unintended result when the first column is not sorted as required. It is not a safe substitute for an exact ZIP-code lookup.
VLOOKUP also has a structural limitation: it can return information only from a column to the right of the lookup column. If ZIP codes are in column C and the value you want is in column A, selecting a wider range will not make VLOOKUP search to the left. You would need to rearrange the data or use another lookup function.
Use an exact-match formula with the right range
For a basic lookup, confirm the cell layout before checking anything more complicated: ZIP codes are in A2:A100, return values are in B2:B100, and the requested ZIP code is in D2. The formula below searches the ZIP-code column and returns the corresponding value from column B:
=VLOOKUP(D2,$A$2:$B$100,2,FALSE)
The dollar signs make the table range absolute. If you copy the formula down a column, the search reference can change from D2 to D3 while the table stays fixed. The 2 is counted from the left edge of the selected range, not from the worksheet: in A:B, A is column 1 and B is column 2. If your table instead begins in C, the return column number must be counted from C.
Do not include a heading row in the data range if the search value could match a heading, and make sure the selected range includes every row that might contain a ZIP code. A range that stops at row 100 will not find a new record added in row 101. An Excel Table can make growing data easier to manage because its references can expand when you add rows.
Check text, numbers, and leading zeros
Select a ZIP-code cell and inspect the formula bar and number format. A cell can display 02108 because it has a custom number format while still storing the numeric value 2108. Formatting changes how a number is displayed; it does not turn the stored number into text. Conversely, a ZIP code entered with a leading apostrophe, such as ‘02108, is stored as text, and the apostrophe itself is not shown in the cell.
For a U.S. five-digit ZIP code stored as a number, a helper column can create a five-character text key. Assume the original numeric ZIP codes are in A2:A100. Enter this in a spare column beside the first record and fill it down:
=TEXT(A2,"00000")
For example, if A2 contains the number 2108, the formula returns the text 02108. This approach is for standard five-digit codes; it is not a universal conversion for ZIP+4 values, international postal codes, or data that already contains meaningful letters or punctuation. Keep those identifiers as text in a consistent format rather than forcing them into a five-digit pattern.
Suppose the helper keys are now in C2:C100, the return values remain in B2:B100, and D2 contains a numeric ZIP code to search for. You can make a matching formatted search key inside the lookup formula:
=VLOOKUP(TEXT(D2,"00000"),$C$2:$D$100,2,FALSE)
This example assumes the return values have been copied or arranged in D2:D100, so the lookup range begins with the helper key in C and returns its second column. If your return data is still in B, VLOOKUP cannot return to the left; rearrange the columns or use XLOOKUP. For the simplest, most maintainable workbook, it is often clearer to put normalized keys and return values side by side in a dedicated lookup table.
Inspect the table layout and return-column number
Even when the ZIP code is an exact match, a formula can point to the wrong place. The range’s first column must contain the ZIP codes. If the selected range is B2:C100 but ZIP codes are actually in A, VLOOKUP will search B, not A. If the return value is in the third column of a selected range, the column index must be 3, even if that worksheet column happens to be column D or E.
- Confirm that the first column in the range is the ZIP-code key.
- Count the return column from the left edge of the range.
- Check that the range includes the row containing the desired record.
- Use dollar signs around a range you intend to copy down.
- Check for duplicate ZIP codes: VLOOKUP returns the first matching row, not every matching record.
Duplicates may be legitimate if your table has multiple locations, services, or dates for one ZIP code. In that case, ZIP code alone may not uniquely identify a record. You may need a second key, such as ZIP code plus location type, or a method that can return multiple results.
Understand the error or unexpected result
A #N/A error usually means Excel did not find an exact match, but it can also signal inconsistent formatting, spaces, or a range that misses the record. A #REF! error commonly means the return-column index points beyond the number of columns in the selected range. A plausible but incorrect answer often calls for checking whether the formula omitted FALSE, whether the range shifted after copying, or whether duplicate keys exist.
To investigate, click the formula cell and use Formulas > Evaluate Formula on Excel for Microsoft 365 for Windows. The feature steps through the calculation so you can see the lookup value, selected range, and result. You can also select the lookup value and a source ZIP code and compare their displayed values and number formats. The Windows shortcut Ctrl+` toggles formula display; on Mac, the equivalent is Control+` in many keyboard layouts, though the key placement can vary.
Removing spaces can help when values came from a web page or a text file. For example, if ZIP-code text is in A2 and may contain ordinary spaces at either end, you can make a cleaned helper value with this formula:
=TRIM(A2)
TRIM removes leading and trailing ordinary spaces and reduces repeated spaces between words. ZIP codes should not contain internal spaces, but pasted data may. TRIM does not remove every invisible character that can arrive from external sources, such as a nonbreaking space. If cleaning does not solve the mismatch, inspect the source data or use a controlled import-and-clean process rather than applying increasingly broad transformations without checking what they change.
Choose an alternative when VLOOKUP is the wrong fit
XLOOKUP is available in Microsoft 365 and Excel 2021 or later. It lets you specify the lookup and return columns separately, so the return column can be on either side of the ZIP-code column. Assume the ZIP codes are in A2:A100, return values are in B2:B100, and the search code is in D2:
=XLOOKUP(D2,$A$2:$A$100,$B$2:$B$100,"Not found",0)
The final 0 explicitly requests an exact match, and the fourth argument supplies a readable message if no match is found. XLOOKUP does not fix a text-versus-number mismatch by itself, so the ZIP keys still need consistent data types and formatting.
INDEX and MATCH are another option, particularly in older Excel versions or when you need a lookup that can return from either side. They require a little more formula setup, while VLOOKUP remains easy to read for a simple left-to-right table. For a one-time search, Find can locate visible text, but it is not a replacement for a formula when results need to update automatically.
Frequently Asked Questions
Why does VLOOKUP return #N/A for a ZIP code that I can see?
It may look the same while being stored differently, such as numeric 2108 versus text 02108. Also check for extra spaces, a range that excludes the row, or a lookup column that is not the first column of the selected range. Use FALSE for an exact match.
How do I keep Excel from removing the first zero?
Format the destination cells as Text before entering or importing ZIP codes, or create a text key for numeric five-digit ZIP codes with a helper formula such as TEXT using the 00000 format. Changing a cell to Text after Excel has already removed the zero does not restore it automatically.
Should I use TRUE or FALSE for a ZIP-code VLOOKUP?
Use FALSE for an exact ZIP-code match. TRUE, or leaving the last argument out, requests approximate matching and is meant for ordered lookup ranges where a nearest lower match is useful, not for identifying a particular postal code.
Can VLOOKUP return a value from a column to the left?
No. VLOOKUP searches the first column of its range and returns from a column to the right. Rearrange the lookup table or use XLOOKUP in Microsoft 365 or Excel 2021 and later.
Can one ZIP code match more than one row?
Yes. VLOOKUP returns the first matching row only. If several records share a ZIP code, use an additional identifying field or a method designed to return multiple results instead of assuming ZIP code uniquely identifies a record.
Related
- Find and Replace Font in Word: Full Steps and Tips
- Find and Replace Highlight Color in Microsoft Word
- Find and Replace in Word: Open and Use the Dialog Box
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- Excel #REF! Error: Causes and How to Fix ItThe #REF! error in an Excel formula means that the formula contains an invalid cell reference. Find the…
- Excel Flash Fill Not Working? Fix the Most Common CausesIf Flash Fill is not working in Excel, enter a clear example beside your source data, select the…
- SUMIFS Not Working? Fix Common Excel ErrorsIf SUMIFS is returning the wrong total, check that the sum range and every criteria range cover matching…
- Excel Spill Error: Causes and Ways to Fix ItThe Excel #SPILL! error means a formula is trying to return results into multiple cells, but Excel cannot…
- Excel #NAME? Error: Causes and FixesYou are getting Excel’s #NAME? error because Excel cannot recognize some text in a formula as a valid…
- Excel Data Model Error: Causes and FixesAn Excel Data Model error usually means Excel cannot create, refresh, or read the workbook’s model, which stores…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.