Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Cannot Find a Match? Fix VLOOKUP and XLOOKUP

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

When Excel says it cannot find a match, the lookup formula is working correctly but the value you are searching for does not exist in the lookup range in the exact form Excel expects. The fix is almost always one of four things: the lookup value has trailing spaces, the data types differ (text vs number), the range reference is wrong or not locked, or the fourth argument of VLOOKUP is missing. Work through the checks below in order and the formula will return a result.

What You'll Need

  • Your Excel workbook with the formula that returns #N/A or a 'cannot find' message
  • The lookup table on the same sheet or a sheet you can reference
  • Basic ability to edit a formula in the formula bar

Step-by-Step

  1. Confirm the error type. Click the cell with the problem. If the formula bar shows #N/A, Excel found no match. If it shows #REF!, the range is broken. If it shows #VALUE!, an argument is the wrong type. The steps below assume #N/A, which is the usual 'cannot find a match' error.
  2. Check the exact value being looked up. In an empty cell, type =LEN(A2) (replace A2 with the cell holding your lookup value) and press Enter. Then type =LEN(D2) where D2 is the first cell of the lookup column. If the lengths differ when the visible text looks identical, you have hidden characters or spaces. A common cause is a trailing space in imported or pasted data.
  3. Remove stray spaces. Wrap the lookup value in TRIM: change =VLOOKUP(A2,$D$2:$F$100,2,FALSE) to =VLOOKUP(TRIM(A2),$D$2:$F$100,2,FALSE). If the lookup column itself contains the spaces, add a helper column with =TRIM(D2) and point the formula at that column instead.
  4. Check for text stored as numbers. Select the lookup column. If the values are left-aligned by default, Excel is treating them as text. A number stored as text will never match a real number. Convert with Text to Columns: select the column, go to Data > Text to Columns, click Finish. Or multiply by 1 in a helper column: =D2*1. Then re-test the formula.
  5. Verify the lookup range. The first column of the range you pass to VLOOKUP must contain the values you are searching for. If your IDs are in column A but the range starts at column B, VLOOKUP will search the wrong column. Rewrite the range so the key column is first, or switch to INDEX/MATCH or XLOOKUP, which do not require the key to be first.
  6. Lock the range with absolute references. If you plan to copy the formula down, the range must not shift. Use $D$2:$F$100 rather than D2:F100. Press F4 after selecting the range in the formula bar to add the dollar signs.
  7. Set the match mode correctly. For VLOOKUP, the fourth argument must be FALSE (or 0) for an exact match. If it is TRUE or omitted, Excel assumes the list is sorted and returns wrong or missing results. For XLOOKUP, the sixth argument defaults to exact match, so leave it blank or set it to 0.
  8. Re-enter the lookup value manually. Sometimes the cell you are referencing contains a formula that returns a value with a different type than it appears. Type the value directly into the formula, for example =VLOOKUP("A1001",$D$2:$F$100,2,FALSE), and see if it matches. If it does, the source cell is the problem, not the table.
  9. Test with a known value. Copy a value directly from the lookup column into the lookup cell. If the formula now works, the original lookup value was mistyped or formatted differently. Compare character by character, including case and punctuation.
  10. Wrap the formula in IFERROR for a clean result. Once the match works, you can hide future misses with =IFERROR(VLOOKUP(...),"Not found"). This does not fix a broken match, but it stops #N/A from spreading through dependent formulas.

Common Mistakes

  • Leaving the fourth argument of VLOOKUP blank. Excel then uses approximate match, which fails silently on unsorted data.
  • Searching a column that looks like the key but is not the first column of the range.
  • Forgetting absolute references, so the range drifts as the formula is filled down.
  • Mixing text and numbers. A common case is an ID column imported as text next to a manually typed numeric ID.
  • Trailing spaces from copy-paste or CSV import. They are invisible and break exact matches.
  • Using a lookup range that does not include the return column. VLOOKUP cannot return a column to the left of the key.

Tips

  • Use XLOOKUP where available: it searches any column, defaults to exact match, and returns a clean 'not found' value if you supply one.
  • Keep lookup keys in a consistent format. Store IDs as text or as numbers, but not both.
  • Use a helper column with TRIM and CLEAN for imported data, then point the formula at the cleaned column.
  • Name your lookup range (Formulas > Define Name) so references are easier to audit and less likely to drift.
  • Turn on Filter and search the lookup column for the exact value to confirm it exists before blaming the formula.

Troubleshooting

If the formula still returns #N/A after the checks above, work through these in order:

  1. Press Ctrl+` (the key left of 1) to show formulas instead of results. Confirm the range in the formula matches the sheet and columns you expect.
  2. Check for merged cells in the lookup column. Merged cells store the value only in the top-left cell, so other rows appear blank to the formula.
  3. Look for hidden rows or a filter that hides the matching row. Clear filters with Data > Clear.
  4. Check whether the workbook is in manual calculation mode. Go to Formulas > Calculation Options and set it to Automatic, then press F9.
  5. If the data comes from an external connection or Power Query, refresh it before testing.
  6. As a last resort, copy the lookup column and the lookup value into a new sheet as values only (Paste Special > Values) and test there. If it works in the clean sheet, the original sheet has a formatting or hidden-character problem.

Frequently Asked Questions

Why does VLOOKUP return #N/A when I can see the value?

Usually a trailing space, a text-versus-number mismatch, or a missing FALSE in the fourth argument. Check the length of both cells with LEN and compare their alignment.

What is the difference between #N/A and #VALUE! in a lookup?

#N/A means no match was found. #VALUE! means an argument is the wrong type, for example a range where a single value is expected.

Can XLOOKUP find a match when VLOOKUP cannot?

Yes, in many cases. XLOOKUP searches any column and defaults to exact match, so it avoids the two most common VLOOKUP mistakes. It is available in current Microsoft 365 and recent perpetual versions of Excel.

How do I match case-sensitive text?

Use EXACT inside an array formula or XLOOKUP with the match mode set to exact. Standard VLOOKUP ignores case.

Why does the formula work for some rows but not others?

That points to inconsistent data in the lookup column, such as mixed text and numbers or stray spaces in some rows. Clean the column with TRIM and Text to Columns.

Does IFERROR hide a real problem?

It hides the error display, not the cause. Use it for presentation only after you have confirmed the match logic is correct.