The TRIM function in Excel
The syntax for the
Pretty simple! Just feed in a string of text, and
TRIM( " Excess ")
TRIM( "Spaces ")
TRIM( " There are many excess spaces in this text. ")
"There are many excess spaces in this text."
As with all other string functions, you can use
Why use it?
Trimming the spaces off of a string of text makes things look pretty, but why would you ever want to use it in a practical context? It turns out, the
If you are working with a data set of your own, you can be fairly confident that it is well-organized, well-structured, and clean. But oftentimes, you'll receive a data set from somebody else that isn't as clean as you want it to be — either because it wasn't originally put together well, or because it is based off of a data source with lots of extra characters like trailing spaces at the end of strings.
This normally wouldn't be a problem, but if you want to use any of Excel's more compex functions — like the
Imagine, for example, that you're trying to perform a
Save an hour of work a day with these 5 advanced Excel tricks
Work smarter, not harder. Sign up for our 5-day mini-course to receive must-learn lessons on getting Excel to do your work for you.
- How to create beautiful table formatting instantly...
- Why to rethink the way you do VLOOKUPs...
- Plus, we'll reveal why you shouldn't use PivotTables and what to use instead...