Text

Removing extra spaces from text

Definition

Stripping extra spaces from a label means giving TRIM the cell that holds the text.

Syntax

=TRIM(text)

Arguments

Argument Meaning
text The cell that holds the label with extra spaces.

Worked example

A catalog stores titles in B2:B4. The first title has two spaces between the words.

A: Row B: Title
1 oak  tree
2 pine cone
3 birch leaf

Formula: =TRIM(B2)

Result: oak tree. The extra space between oak and tree is removed, leaving one space.

Practice

Cell A2 holds red with extra spaces around it. In B2, write a formula that removes those extra spaces.

  1. In B2, write a TRIM formula for A2.
Step 1 of 2
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…

Related functions

TRIM is the function that strips the extra spaces from the label.

Common mistake

Comparing the untrimmed cell to oak tree, so the extra spaces stop the match even though the words look the same.

Related functions

These links are related functions.