Remove extra spaces from text, leaving single spaces between words.
This function works the same in Google Sheets as it does in Excel — same syntax and arguments.
TRIM(text)TRIM strips leading, trailing, and duplicate spaces — a common cause of failed lookups and mismatched joins. Run it on imported or copied data before matching with VLOOKUP or XLOOKUP.
=TRIM(" Jane Doe ")Result: Jane Doe
Collapses the extra spaces to single spaces.
Invisible trailing spaces make two values look equal but not match. TRIM removes them so the lookup keys align.