If an exact-match VLOOKUP, XLOOKUP, or INDEX/MATCH returns #N/A, the lookup value usually differs from the source by text formatting, hidden characters, a locale-specific number format, or floating-point precision. Fix the type mismatch first, then clean or round the data. If you skip that order, formulas can look right while reports, reconciliations, and totals break. This guide shows how to identify each cause fast and apply the shortest fix.
Why exact matches fail
An exact match fails when Excel sees two values as different, even if they look the same on screen. The common causes are text-versus-number mismatches, hidden spaces or characters, precision drift from calculated values, or imported data that changed type on the way into Excel. #N/A means the lookup did not find the exact value it was asked to find.
Text versus number mismatches
Excel stores text and numbers differently. A value that looks like 1001 may be text in one cell and a number in another, and an exact match will fail. Check this first when a formula works for some rows but not others, especially after copying from web forms, CSV files, or Power Query imports.
Hidden spaces and hidden characters
Trailing spaces, nonbreaking spaces, and pasted control characters can block a match without changing what you see in the cell. TRIM is the first cleanup test for trailing spaces, but it does not remove every hidden character. If TRIM helps, the issue is usually in the source text, not the lookup logic.
Floating-point precision drift
Calculated values can look identical and still compare as different because Excel stores them in binary form. This matters when a formula-built lookup value is compared against another formula result, especially across VLOOKUP, XLOOKUP, and INDEX/MATCH.
Suppose a formula returns 12.3 on screen, but the stored value is slightly different after calculation. A lookup against another value that also displays 12.3 can still fail. Rounding the lookup side, the source side, or both can bring the values back into the same exact-match bucket.
Locale-specific comma and period issues
European Excel setups can expose a different kind of mismatch: values imported as text may keep a comma decimal separator, while formulas or pasted data use a period, or the reverse. The result is that two entries may appear equivalent but are stored with different underlying types or formats. When that happens, the lookup often fails before TRIM or ROUND can help, because the value has to be converted into a consistent numeric or text form first.
Power Query and imported type mismatches
Power Query and other imports can quietly turn IDs, postal codes, or invoice numbers into text on one refresh and numbers on the next. That creates exact-match errors even though the visible values do not change. The safest diagnostic step is to compare the imported column type with the lookup column type before changing the formula.
How VLOOKUP exact match works
VLOOKUP looks in the first column of the selected table array for the lookup value. Its fourth argument controls match mode: FALSE or 0 forces exact match, while omitting that argument defaults to TRUE, which uses approximate match. If no exact match is found, VLOOKUP returns #N/A.
Exact match versus approximate match
For troubleshooting, exact match is often the default choice. Approximate match is useful only when the first column is sorted and you want the nearest lower value. If the argument is blank or omitted, Excel assumes approximate match, which is why formulas can return the wrong row or fail in confusing ways.
Why the first column matters
VLOOKUP only searches the leftmost column of the table array. If the lookup value is not in that first column, the formula cannot find it no matter how close the rest of the table looks. A shifted range can create the same symptom after copying formulas.
Troubleshooting matrix
Use this matrix to sort the failure before changing the formula. Start with the symptom, test the likely cause, then apply the fastest fix. That order matters because TRIM, ROUND, and range locking solve different problems.
| Symptom | Likely cause | Quick test | Fix |
|---|---|---|---|
| Lookup value appears present, but VLOOKUP returns #N/A | Omitted FALSE or 0, so Excel used approximate match | Check whether the fourth argument is blank | Add FALSE or 0 to force exact match |
| Only some values fail, especially pasted text | Text/number mismatch | Compare the cell format or wrap the value in a type-conversion check | Convert both sides to the same type before lookup |
| Cells look identical, but only one row matches | Hidden spaces | Test the value with TRIM and compare lengths if needed | Use TRIM on the source text or cleaned helper columns |
| Calculated numbers match on screen, but exact match fails | Floating-point drift | Round the lookup result and compare again | Use ROUND at 1 decimal place or 10 decimals, depending on the data |
| Formula works in one row, then breaks after copy | Shifted ranges | Inspect whether the table array moved when the formula was filled | Lock the range with absolute references using $ |
| Imported IDs fail after Power Query refresh | Data type changed on import | Check whether the refreshed column became text instead of a number | Convert the lookup column and source column to the same type before matching |
| Values match in one locale but not another | Comma-versus-period decimal separator mismatch | Inspect whether the value is stored with the expected separator for that workbook | Normalize the imported values before the lookup |
Diagnose before fixing
Use a simple test flow before changing the formula: compare type, then compare text cleanup, then compare precision. That reduces guesswork and prevents you from applying TRIM or ROUND to data that already matches.
Step 1: test the value pair. Check the lookup cell and the source cell side by side. If one is text and the other is numeric, the formula can fail even though both display the same characters.
Step 2: test for hidden characters. If the values look identical, clean the text version first. TRIM removes leading and trailing spaces and collapses repeated spaces, but pasted nonbreaking spaces can still remain and keep the match broken.
Step 3: test the precision path. If the value comes from a calculation, compare a rounded version to the source. Precision drift is more likely when the lookup value is formula-generated rather than typed.
Step 4: test the import path. If the data came from Power Query or another import, verify that both columns still have the same type after refresh. A refresh can change the storage type even when the displayed value does not change.
- Clean the text first. Apply TRIM to the source values if the failure involves pasted labels, codes, or names. This removes trailing spaces that can block a visible match.
- Match the data type. Check whether both sides are text or both sides are numbers. If one side is stored differently, convert it before testing the formula again.
- Round calculated values. If the lookup value is formula-generated, try ROUND at 1 decimal place, then 10 decimals if the data needs more precision. This handles binary rounding drift without changing the source table structure.
Fix the lookup value
The fastest repair is to clean the value that is being searched, then retest the lookup. Work from the simplest cause upward: spaces first, then type mismatch, then precision drift. That sequence avoids overcorrecting data that is already fine.
Use TRIM for trailing spaces
If the source text may contain extra spaces, TRIM is the first test. It removes leading and trailing spaces and collapses repeated internal spaces to single spaces. If a cleaned helper column resolves the match, the issue is formatting, not lookup syntax.
Normalize text and numbers
When one side is text and the other is numeric, make them the same before comparing. The exact method depends on the data: convert numeric text to numbers, or format numbers as text only if the source system stores them that way. Do not assume identical appearance means identical type.
Use ROUND for calculated values
When the lookup value comes from a formula, round it before the lookup or round the source column in a helper field. Use the smallest rounding that preserves the meaning of the data.
- Clean the text first. Apply TRIM to the source values if the failure involves pasted labels, codes, or names. This removes trailing spaces that can block a visible match.
- Match the data type. Check whether both sides are text or both sides are numbers. If one side is stored differently, convert it before testing the formula again.
- Round calculated values. If the lookup value is formula-generated, try ROUND at 1 decimal place, then 10 decimals if the data needs more precision. This handles binary rounding drift without changing the source table structure.
Lock ranges and prevent copy errors
Absolute references with $ keep copied formulas from shifting the lookup range. That matters when a formula works in the first row but fails after fill-down because the table array moved. The lookup logic may be correct, while the range reference is not.
- Anchor the table array. Change the lookup range to absolute references before copying the formula. This keeps the first-column search area fixed across rows.
- Check the filled formula. Inspect a copied cell and compare its references with the original. If the table array shifted, correct the range and retest the match.
Replace errors after the match is fixed
After the lookup logic is correct, IFERROR can replace #N/A with a custom message. Use it to improve readability, not to hide an unresolved lookup problem. If the data still does not match, IFERROR only changes the display.
A practical pattern is to fix the data first, then wrap the lookup so the result shows a clear message such as “Not found” when a true miss remains. That keeps reports cleaner without masking an exact-match failure.
Frequently asked questions
Why does my Excel formula not find an exact match?
Exact-match formulas usually fail because the compared values are not truly equal. The cause is often a text/number mismatch, hidden spaces, locale formatting differences, or floating-point precision drift. Start by checking the data type and cleaning the text, then round calculated values if the lookup input is formula-generated.
Why does VLOOKUP return #N/A when the value is there?
#N/A means VLOOKUP did not find the exact value it was asked to find. In practice, the value may be in the table but stored differently, such as text instead of a number, or it may contain hidden spaces. Also check that the lookup range starts with the lookup column.
How do I force VLOOKUP to use an exact match?
Put FALSE or 0 in the fourth argument. That tells VLOOKUP to use exact match instead of approximate match. If you leave the argument out, Excel defaults to TRUE, which changes the match behavior and can return the wrong row.
Why does XLOOKUP also fail on exact matches?
XLOOKUP still depends on the lookup value being exactly equal to the source value. If a formula-generated value differs by a tiny amount, XLOOKUP can return no match even when the displayed numbers look the same. ROUND is the practical fix when precision drift is the cause.
Can floating-point rounding cause lookup errors?
Yes. Binary rounding can make visually identical numbers compare as different, and that breaks exact-match lookups in VLOOKUP, XLOOKUP, and INDEX/MATCH. Rounding the lookup result to 1 decimal place or 10 decimals is a common workaround when the data comes from calculations.
Should I use FALSE or 0 for exact match?
Either one works for exact match in VLOOKUP. The key point is that the fourth argument must explicitly request exact matching, because omitting it defaults to TRUE. Pick one style and use it consistently so the formula’s intent stays obvious during review.
How do I fix hidden spaces or text-number mismatches in lookup values?
Use TRIM first when the problem looks like spacing. If that does not solve it, check whether one side is text and the other is numeric, then convert them to the same type before looking up the value. Hidden characters and type differences often occur together in pasted data.
What should I do when the formula works for some values but not others?
That pattern usually points to inconsistent source data, not a broken formula. Check the values that fail for spaces, data type differences, and formula-generated precision drift. If copied formulas are involved, also verify that the table array did not shift after fill-down.
Why in excel formula not calculating
If the formula is not calculating as expected, confirm that the lookup range, match mode, and data type are all aligned. For lookup errors, the usual cause is a mismatch in the data rather than the formula text itself. Fix the source values first, then use IFERROR only to control the final display.