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.
- In B2, write a TRIM formula for A2.
- B2 should show A2 without extra spaces.
Step 1 of 2
Enter =TRIM(A2) in B2.
A2 is red with extra spaces, so TRIM leaves red.
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…
B2 uses TRIM.
B2 now shows red.
The next lesson is Replacing one word with another.
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.