If the formulas in your Google Sheets aren’t matching data correctly, i.e., lookups fail, comparisons return FALSE, or joins don’t work even when values look identical.
This usually shows up as #N/A in lookups, mismatched joins, or logical tests failing unexpectedly.
This guide fixes it step by step.
Why the Issue Happens
- Text vs number mismatch (e.g.,
100vs"100") - Extra spaces or hidden characters
- Case sensitivity differences
- Different formats (dates, currencies, percentages)
- Leading zeros missing or inconsistent
- Data imported from multiple sources
- Invisible characters (non-breaking spaces, line breaks)
- Partial matches vs exact matches
Step-by-Step Fixes
Step 1: Check If Values Truly Match
Use this test:
=EXACT(A2, B2)
- TRUE → exact match
- FALSE → mismatch exists
If FALSE, proceed to clean data.
Step 2: Fix Text vs Number Mismatch
Example:
100(number)"100"(text)
Fix:
=VALUE(A2)
or
=TEXT(A2, "0")
Ensure both columns use the same type.
Step 3: Remove Extra Spaces
Hidden spaces are a major cause.
Fix:
=TRIM(A2)
For full column:
=ARRAYFORMULA(TRIM(A2:A100))
Step 4: Remove Hidden Characters
Imported data often contains non-printable characters.
Fix:
=CLEAN(A2)
Combine:
=TRIM(CLEAN(A2))
Step 5: Standardize Case
“Sales” ≠ “sales” in exact matching.
Fix:
=LOWER(A2)
or
=UPPER(A2)
Apply to both datasets before matching.
Step 6: Fix Leading Zeros
Example:
00123vs123
Fix:
=TEXT(A2, "00000")
Adjust format based on required length.
Step 7: Standardize Date Formats
Dates may look same but differ internally.
Fix:
=DATEVALUE(A2)
Then format as date.
Step 8: Debug Lookup Failures
If VLOOKUP or INDEX MATCH fails:
Test:
=MATCH(A2, B:B, 0)
If #N/A, values don’t match exactly.
Fix using cleaned data:
=INDEX(C:C, MATCH(TRIM(A2), B:B, 0))
Step 9: Use Helper Column for Clean Data
Instead of modifying raw data:
=TRIM(CLEAN(LOWER(A2)))
Then use this cleaned column for matching.
Step 10: Use REGEX for Complex Cleaning
If data is messy:
=REGEXREPLACE(A2, "[^a-zA-Z0-9]", "")
Removes unwanted characters.
Common Mistakes
- Assuming visually identical values are actually identical
- Ignoring hidden spaces or characters
- Mixing text and numbers
- Not standardizing case
- Forgetting leading zeros
- Using exact match without cleaning data
- Not debugging with MATCH or EXACT
Pro Tips / Better Alternatives
Use FILTER Instead of VLOOKUP for Debugging
=FILTER(B:B, A:A=A2)
Shows matching rows (or none).
Use COUNTIF to Check Matches
=COUNTIF(B:B, A2)
- 0 → no match
- 0 → match exists
Combine Multiple Cleaning Steps
=TRIM(CLEAN(LOWER(A2)))
Standardize data before matching.
Use QUERY for Structured Matching
=QUERY(A:B, "SELECT B WHERE A = 'value'", 0)
Useful for clean datasets.
Build Data Cleaning Pipeline
Best practice:
- Raw data → cleaned column → lookup
Avoid using raw data directly in models.
Bottom Line
If data mismatch issues occur, fix in this order:
- Check exact match using
EXACT - Fix text vs number mismatch
- Remove spaces and hidden characters
- Standardize case and formatting
- Handle leading zeros and dates
- Use cleaned helper columns
Most issues come from dirty or inconsistent data, not formulas.
Clean the data first, and matching will work reliably.