TRIM
Functions to Remove Extra Characters
Basic Description
The Excel Trim function takes a supplied text string and removes all spaces, except for single spaces between words or characters.
The syntax of the function is :
where the 'text' argument can be supplied to the function either directly, as a text string returned from another formula, or a reference to a cell containing text.
Note that the Trim function differs from the Clean Function 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 example below shows the Trim function used on 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.