excelback.com
=FUNCTIONS

TRIM()

Text

Removes leading and trailing spaces from text, and collapses multiple spaces between words to one.

TRIM(text)

TRIM cleans up extra spacing — a common problem in data pasted from other systems or typed inconsistently. It strips spaces from both ends and reduces any run of internal spaces to a single space.

It only removes the regular space character. Text copied from web pages often contains non-breaking spaces instead, which TRIM leaves untouched — those usually need SUBSTITUTE(text, CHAR(160), " ") first.

Arguments

text
The text to remove extra spaces from.

Examples

=TRIM(" John Smith ")
John Smith

Leading/trailing spaces gone, double space collapsed to one.

Related functions