Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed:
A lookup or comparison that should succeed silently fails when one or both values have leading or trailing whitespace. The characters '"Apple"' and '"Apple "' are different strings — the trailing space makes them unequal, so VLOOKUP returns #N/A and IF returns FALSE even though the values look identical on screen.
=VLOOKUP(A2,$D:$E,2,0)=VLOOKUP(TRIM(A2),$D:$E,2,0)TRIM(A2) strips leading and trailing spaces from the lookup value before comparing it to the table. If the table column D also has spaces, use TRIM on the table range too, but that requires an array formula or cleaning the table data.
Edit the grid or formula, then run it through a real spreadsheet engine — no signup.
Sample data — click any cell to edit
Stop hunting errors by hand.
Upload your spreadsheet and the Auditor flags every No match and broken formula at once — or paste this one formula and get the fix explained.
The extra characters may be non-breaking spaces (CHAR(160)), line breaks (CHAR(10) or CHAR(13)), or other invisible Unicode characters. Use =SUBSTITUTE(TRIM(A2),CHAR(160),"") to remove non-breaking spaces, or =CLEAN(TRIM(A2)) to strip line breaks.
Use Find & Replace (Ctrl+H), search for ' ' (a single space) with 'Find All'. This does not distinguish leading from trailing, but highlights cells with any spaces. For precision, use a helper column with =LEN(A2)<>LEN(TRIM(A2)) and filter for TRUE.
In Excel, =VLOOKUP(TRIM(A2),TRIM(D:D),2,0) requires Ctrl+Shift+Enter to enter as an array formula; otherwise TRIM only acts on the first cell of D:D. In Google Sheets, wrap in ARRAYFORMULA: =VLOOKUP(TRIM(A2),ARRAYFORMULA(TRIM(D:D)),2,0).
Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.
Last reviewed: