In this lesson, you will learn how to use the TRIM function.
Thanks to the TRIM function, you can remove spaces from the text.
Trim function syntax
Syntax of TRIM function is:
If you have text with extra spaces in A1 cell, just writhe a formula =TRIM(A1). TRIM function removes extra spaces that you don’t need.
Trim function examples
You can also use TRIM function with other functions.
Remove extra spaces in Excel
To remove leading, trailing, and extra spaces from a text string use this simple formula.
To remove all spaces from a text string except for a single space between words use:
=TRIM(SUBSTITUTE(A1,” “,REPT(” “,1)))
Extract text after the last full stop in a text string
You want to extract text after the last string. Just use the formula below with the TRIM function.
Of course, you can modify this formula. If you have a problem with another character (e.g., a question mark), just change the full stop with this character in the formula.
If your string text is longer than 10, just increase it.
Finding words in a long string of text
You want to find some word in a long string of text and you don’t know how to do it? Try this formula:
Just replace WORD with your text.
If you want to get a text without a WORD string just change the formula to:
Find exact value in cell
The task is to find the exact value in the cell. It means that when you want to find “15”, Excel will find you only cells with “15”, but not with “1515”, “215,” “150”…