removes excess spaces from a text string.
TRIM(text)
returns text with any leading or trailing spaces removed, and with any multiple spaces replaced with a single space.
TRIM(" Good Morning ")
returns Good Morning.
Cleaning Up a Customer Contact List
Imagine you're managing a customer contact list that was compiled by several different people. As a result, the data in the "Full Name" column is messy, with leading, trailing, and multiple spaces between words. This inconsistent formatting makes it difficult to sort the list correctly or use the names in a mail merge.
Here's a sample of the raw data:
Raw Name | ||
|---|---|---|
A | ||
1 | John Doe | |
2 | Jane Smith | |
3 | Peter Jones | |
4 | Sarah Williams | |
5 | Michael Brown |
To clean this data and create a consistent "Clean Name" column, you would use the TRIM function.
Step-by-step process:
After applying the formula, your table will look like this:
Raw Name | Clean Name | ||
|---|---|---|---|
A | B | ||
1 | John Doe | John Doe | |
2 | Jane Smith | Jane Smith | |
3 | Peter Jones | Peter Jones | |
4 | Sarah Williams | Sarah Williams | |
5 | Michael Brown | Michael Brown |
As you can see, the TRIM function successfully removed the leading spaces from "John Doe" and "Peter Jones," the trailing spaces from "Jane Smith," and the multiple spaces between the first and last names in all the examples, leaving only single spaces. The "Clean Name" column is now properly formatted and ready for use in other tasks.
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof