Features of !SEMTools
↑ Навигация по задачам в Excel и возможностям надстройки !SEMTools ↑

TRIM

TRIM function in Excel, examples
Function categoryText
VolatilityNon-volatile

What does the TRIM function do

The TRIM function allows you to remove extra spaces from text.

It considers spaces at the beginning and end of a cell as extra, as well as double, triple, etc. spaces between words and characters in the middle of a cell. Generally, it refers to any number of spaces more than one between words.
The function often plays an auxiliary role when creating complex compound formulas.

TRIM function syntax

=TRIM(text)
What TRIM removes
B2=TRIM(A2)
ABC
1Text (· space, ° non-breaking)TRIMLength before → after
2··hello···world·hello·world=TRIM(A2)16 → 11
3one··twoone·two=TRIM(A3)8 → 7
4text°°text°°=TRIM(A4)6 → 6
5··=TRIM(A5)2 → 0

TRIM removes spaces at the start and end and leaves one space between words. The non-breaking space (code 160) from web pages isn’t touched — use =TRIM(SUBSTITUTE(A4,CHAR(160)," ")).

Remove extra spaces with TRIM function
How to remove extra spaces with a function

TRIM formula examples

See examples:
REPT function in Excel
Add symbols before/after each word
Remove last word in Excel

Compress spaces without the TRIM function

Sometimes you want to remove spaces in selected cells without formulas and columns. Unfortunately, Excel's standard set of procedures doesn't have this capability.

But if your Excel has the !SEMTools add-in connected - it does! Read more in the article:

Remove extra spaces in Excel

Remove extra spaces from Excel cells in 2 clicks

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.