Why it works
- What it does
- TRIM removes spaces at the start and end of text and squeezes runs of spaces inside to one. Names copied from other systems often carry a trailing space, which breaks exact matches. TRIM the key inside the lookup so the source data can stay as it is.
- The shape of the formula
- =MATCH(TRIM(key), list, 0)
- How to remember it
- An invisible space is still a character.
- The usual mistake
- Trimming the list once by hand. The next export from the sales system brings the spaces back.
Keep practicing
- CLEAN and CHAR(160): characters TRIM cannot seeWhy does TRIM not fix text copied from a website?Open
- UPPER, LOWER and PROPERHow do I turn typed codes into capitals?Open
- Why a lookup returns #N/A when the value is thereWhy does VLOOKUP say #N/A for an item I can see in the list?Open
- Lesson: Join and clean textA short lesson in your workspace: the idea, small steps on a sheet, one task with new dataOpen
Updated