#N/A Error in Lookups: Why It Happens and How to Fix It

A #N/A error in a lookup means the formula could not find an exact match for the value you asked for. In most cases the formula is working correctly and the data is the problem: the value is missing, it is stored in a different format, or it carries a hidden space. Fixing the error usually means fixing the data or the range, not rewriting the formula.

It ends with a worked example you can rebuild in any spreadsheet.

Core terms

Before diagnosing anything, it helps to be precise about the vocabulary.

  • Lookup value: the item you are searching for, such as a product code in a single cell.
  • Lookup range or table array: the block of cells being searched.
  • Return column or result range: the column that holds the answer you want.
  • Exact match: the function returns only an identical value. In VLOOKUP and MATCH this is set with FALSE or 0.
  • Approximate match: the function returns the nearest value that is less than or equal to the lookup value. It requires sorted data.
  • #N/A: “not available”. In a lookup it means no match was found. It is a deliberate signal, not a crash.

The distinction between #N/A and other errors matters. #VALUE! means a formula received the wrong type of data. #REF! means a reference has been deleted. #N/A means the search completed and found nothing.

Binsight Inventory Spreadsheet

Skip the setup

Binsight Inventory Spreadsheet

Stock in, stock out and reorder alerts that turn red before you run out. Uses lookups and conditional formatting.

See it on Taskdale →

The causes of #N/A in lookups

Work through these in order. The first two account for most cases in practice.

SOP 2.1: The value is not in the table

This is the most common cause and the simplest. The product code, customer ID or name simply does not exist in the lookup range. It may have been added to the order sheet before the price list was updated, or the price list may be incomplete.

Confirm it with a direct search. Use Find (Ctrl+F) on the lookup range for the exact value. If nothing appears, the value is missing.

SOP 2.2: Hidden spaces and non-printing characters

A value that looks identical can differ by a trailing space, a leading space, or a non-breaking space (character code 160), which often arrives from web pages, PDFs and some accounting exports. "AB-102" and "AB-102 " look the same on screen but do not match.

Check the length. =LEN(B2) should return 6 for AB-102. If it returns 7, there is an extra character. For a non-breaking space, =CODE(RIGHT(B2)) returning 160 confirms it.

SOP 2.3: Numbers stored as text, or text stored as numbers

A product code of 2201 typed as text in one sheet and entered as a number in another will not match. The formula treats them as different values, and nothing in the cell reveals the difference except alignment. Numbers are right-aligned by default and text is left-aligned, but this can be overridden.

Test with =ISNUMBER(B2) and =ISTEXT(B2). Dates are a common variant: a date imported as text will not match a true date serial number.

SOP 2.4: The lookup column is not the first column (VLOOKUP)

VLOOKUP searches only the leftmost column of the range. If your key sits in column C and your result sits in column A, VLOOKUP cannot find it. Depending on the structure, this often returns #N/A rather than the wrong answer, but it can also return the wrong column if the data happens to line up.

INDEX with MATCH, and XLOOKUP, do not have this restriction. Moving to one of them is often the cleanest fix (see Module 4).

SOP 2.5: Approximate match on unsorted data

When the fourth argument is TRUE or omitted, VLOOKUP assumes the lookup column is sorted and returns the nearest smaller value. On unsorted data it can return #N/A, or a plausible but wrong result. A common cause is a formula copied from a template that defaulted to approximate match.

Set the final argument to FALSE for exact matches unless you have a deliberate reason to use approximate matching, such as banding a salary table.

SOP 2.6: The range is wrong or does not cover the data

A range such as Prices!A1:B100 will miss row 101 onwards. If the price list grew to 150 rows, every code in rows 101 to 150 returns #N/A. This is a silent failure that often appears only after the list is extended.

Full-column references such as Prices!A:B avoid this. Excel Tables (named with structured references such as tblPrices[Code]) expand automatically as rows are added.

SOP 2.7: An upstream error passing through

If the lookup value itself is the result of a formula that returned #N/A, the lookup inherits the error. The fault is one step back. Trace precedents using Formulas, then Trace Precedents in Excel, or the equivalent in Google Sheets, to find the originating cell.

SOP 2.8: Deliberate NA() values

Some modellers use =NA() on purpose to mark a value as not yet available, so that charts skip it. Lookups that reach these cells return #N/A, which is correct behaviour. Check for NA() in the source range before you assume something is broken.

Diagnostic workflow

Use this sequence every time. It takes less time than guessing.

  1. Click the #N/A cell and confirm which lookup value it is using. Read the formula’s first argument, then check the cell it points to.
  2. Copy the lookup value into a blank cell and run =LEN() on it. Compare the result with the length of the code you expect.
  3. Run =ISNUMBER() and =ISTEXT() on the value and on the first matching cell in the lookup range.
  4. Search for the trimmed value with a test formula: =COUNTIF(Prices!A:A, TRIM(B2)). A count of 0 means the value is absent. A count of 1 or more means the problem is formatting, or the range or column arrangement.
  5. If the count is above 0 and the lookup still fails, check the range argument and the match-type argument (FALSE or 0).
  6. If the lookup value is itself a formula, use Evaluate Formula to step through its result.

A count of 0 from SOP step 4 tells you to fix the source data. A positive count tells you to fix the formula or its formatting. That single test saves most of the time spent on this error.

Choosing the lookup function

The function you choose affects how often you will see #N/A and how easily you can handle it. The table below compares the main options for exact-match lookups.

FunctionSearchesCan return from left of keyDefault match typeBuilt-in missing-value handlingAvailabilityBehaviour when columns are inserted
VLOOKUPLeftmost column onlyNoApproximate (unless set)None; use IFNAAll versionsBreaks if column index number is hard-coded
HLOOKUPTop row onlyNoApproximate (unless set)None; use IFNAAll versionsSame risk as VLOOKUP, for rows
INDEX with MATCHAny columnYesExact when MATCH uses 0None; wrap in IFNAAll versionsRobust, because it references columns directly
XLOOKUPAny columnYesExactYes, via if_not_found argumentExcel 2021 and 365, Google SheetsRobust, and handles ranges without index numbers

Choose XLOOKUP where you can, because it removes the leftmost-column limit and replaces the separate IFNA step with an argument. Where your organisation runs older Excel versions, INDEX with MATCH is the standard alternative and works everywhere.

VLOOKUP remains common because it is familiar. It is acceptable for small, stable tables. For shared models that other people will edit, the hard-coded column index is a liability. Insert a column in the source table and the index points at the wrong field, which can produce a wrong answer rather than an error.

Plumline Client Tracker (CRM)

Ready-made template

Plumline Client Tracker (CRM)

Every client, lead and follow-up in one sheet, with drop-downs and status colours already set up.

See it on Taskdale →

Common mistakes

These mistakes appear repeatedly in shared spreadsheets.

  • Wrapping every lookup in IFERROR. This hides broken ranges and deleted columns. Use IFNA for missing values, and let genuine errors show.
  • Leaving the fourth argument blank in VLOOKUP. The default is approximate match, which returns plausible but wrong results on unsorted data.
  • Hard-coding the column index in VLOOKUP. Inserting a column in the source table changes what the index points to.
  • Fixing the output rather than the input. Typing a value over a #N/A cell removes the warning and leaves the underlying gap in place.
  • Sorting the lookup range after building the formulas. This is harmless for exact-match lookups, but it breaks approximate-match lookups silently.
  • Assuming a matching-looking value is a match. Check with LEN, ISTEXT and ISNUMBER before concluding the data is correct.
  • Copying a formula with a relative lookup range. Each copied row searches a shifted range, and the later rows return #N/A because their range has moved past the data.

Worked example

This example uses illustrative data. Build it in a new workbook to test each step.

Setup. The sheet named Prices holds the price list in columns A (Code) and B (Price), with about 400 rows. The sheet named Orders holds order lines, with the product code in column B and the lookup result required in column D.

Step 1: Run the lookup and inspect the results.

In Orders!D2, enter:

=VLOOKUP(B2, Prices!A:B, 2, FALSE)

Copy it down to row 5 and review the results.

OrderCode in OrdersResultWhy
1001AB-1014.50Matches exactly
1002AB-102 (trailing space)#N/AHidden space
1003AB-104#N/ACode absent from price list
10042201 (stored as text)#N/APrice list holds the number 2201

Step 2: Diagnose each failure.

For order 1002, =LEN(B3) returns 7, not 6. The space is confirmed.

For order 1003, =COUNTIF(Prices!A:A, B4) returns 0. The code is missing from the price list, so the data needs correcting.

For order 1004, =ISTEXT(B5) returns TRUE, and in Prices the matching cell returns FALSE for ISTEXT. The two columns store the same code in different formats.

Step 3: Clean the lookup value.

Insert a helper column C (Clean key) and enter in C2:

=IF(ISNUMBER(VALUE(TRIM(B2))), VALUE(TRIM(B2)), TRIM(B2))

This removes spaces and converts numeric-looking codes to numbers so they match a numeric key. For text codes such as AB-101, VALUE returns an error, ISNUMBER returns FALSE, and the trimmed text is used.

If the price list stores all codes as text, change the formula to =TRIM(B2) and convert the price list’s numeric codes to text once, rather than applying the conversion in every row.

Step 4: Apply the lookup with a clear missing-value message.

In Orders!D2, enter:

=IFNA(VLOOKUP(C2, Prices!A:B, 2, FALSE), "Not in price list")

Copy down. Order 1002 now returns 4.50, order 1004 returns its price, and order 1003 returns “Not in price list”.

If the workbook is shared with users on Excel 2021 or 365, the XLOOKUP equivalent is simpler:

=XLOOKUP(C2, Prices!A:A, Prices!B:B, "Not in price list", 0)

Step 5: Resolve the genuine gap.

Filter column D for “Not in price list”. Order 1003 is the only line. Confirm the code with the supplier, add AB-104 to Prices, and recalculate. The new row is picked up because the range is a full-column reference.

Step 6: Check for duplicates.

In the Prices sheet, enter =COUNTIF(A:A, A2) in a helper column and filter for values above 1. If a code appears twice with different prices, the lookup returns the first one without warning. Resolve the duplicate before relying on the totals.

Result. Order lines that previously showed #N/A now show prices or a clear review flag. The helper column makes the cleaning step visible, so anyone auditing the file can see the adjustment.

Decision rules

Use these rules when you meet a #N/A in a lookup.

  • If COUNTIF on the trimmed value returns 0, the value is missing. Correct the source data or confirm the code with the owner.
  • If COUNTIF returns 1 or more, the problem is formatting, range or match type. Check LEN, ISTEXT and ISNUMBER, then the range and the final argument.
  • If the source may contain spaces or pasted characters, add a cleaning step at source, not in every formula.
  • Use IFNA or XLOOKUP’s if_not_found argument for missing values. Do not use IFERROR as a general mask.
  • Set exact match explicitly on every lookup. Treat any approximate match as a deliberate choice that needs a note in the file.
  • Where the audience runs older software, choose INDEX with MATCH over XLOOKUP.
  • Review the “not found” list on each update cycle. An unreviewed list is a hidden backlog of incorrect figures.
Paidmark Invoice and Estimate Kit

Get the finished file

Paidmark Invoice and Estimate Kit

Invoices, estimates, receipts and a payment tracker that flags what’s overdue, all in one Excel file.

See it on Taskdale →

Scroll to Top