Purpose

Return value

Syntax

Using the TRIM function

The TRIM function strips extra spaces from text, leaving only a single space between words, and removing any leading or trailing space.

For example:

The TRIM function can be used together with the CLEAN function to remove extra space and strip out other non-printing characters:

TRIM often appears in other more advanced text formulas.

For example, the formula below will count the number of words in cell A1:

Because this formula depends on single spaces to get an accurate word count, TRIM is used to normalize space before the count is calculated.Full description here.

Excel formula: Split text with delimiter

Notes

TRIM function examples

Split text with delimiter

Cell equals one of many things

Extract nth word from text string

Count total words in a cell

Join cells with comma

Extract multiple lines from a cell

Put names into proper case

Remove leading and trailing spaces from text

Normalize text

Extract word containing specific text

Get last word

Get last line in cell

LAMBDA count words

Sort comma separated values

Extract word that begins with specific character

TRIM function videos

How to clean text with CLEAN and TRIM

How to build all-in-one formulas

CLEAN Function

The Excel CLEAN function takes a text string and returns text that has been “cleaned” of line breaks and other non-printable characters.

Excel formula: Cell equals one of many things

Excel formula: Extract nth word from text string

Excel formula: Count total words in a cell

Excel formula: Join cells with comma

Excel formula: Extract multiple lines from a cell

Excel formula: Put names into proper case

Excel formula: Remove leading and trailing spaces from text

Excel formula: Normalize text

Excel formula: Extract word containing specific text

Excel formula: Get last word

Excel formula: Get last line in cell

Excel formula: LAMBDA count words

Excel formula: Sort comma separated values

Excel formula: Extract word that begins with specific character

Article image

Article image

Excel CLEAN function