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 :

TRIM( text )

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

"trimmed text"

- with no spaces at the start or end and just one space in the middle.

Excelq.com doing business as a Service of Venttraffic Media Inc. Excel and other words on this site may be trademarks or registered trademarks of Microsoft Corporation. Microsoft Corporation is not connected in any way with this website, and makes no endorsement of the site or its related contents. All rights reserved. Website powered by Venttraffic Media Inc.