The Excel TRIM Function
The Excel Trim function removes extra spaces (i.e. all spaces except for single
spaces between words or characters) from a supplied text string.
The syntax of the function is:
TRIM( text )
where the text argument is the text string that you want to remove
the extra spaces from.
Trim vs. Clean Function
Note that the Trim function is similar to the
Excel Clean Function
The two functions differ in that the Trim function removes additional spaces (represented by
the ASCII numeric code 32), while the Clean Function removes the non-printable characters,
represented by the ASCII numerics codes 0 to 31.
Trim Function Examples
The following spreadsheet shows the Trim function applied to four different text strings.
In all four of the above cases, the result is the string
- with no spaces at the start or end and just one space in the middle.
For further information and examples of the Excel Trim function, see the
Microsoft Office website.