Excel Trim Formula
- 3 Comment
How many times have you tried to import a file into Excel, only to have extra blanks all over the place in the document? Well that’s where the Trim Formula can come into play. The Trim formula is used to clean up and remove all the leading and trailing blanks as well as all but one blank in-between text that you may have in a list of cells. So now instead of going into each cell one-by-one, there is one formula to do all the work for you. Let’s take a look at the formula first (it’s a short one):
=Trim(text)
This formula is very easy to use but can make you job a whole lot easier. Let’s take a look at some of the examples now.
Examples
Example 1: =trim(“ Bird “), will return “Bird”
Example 2: =trim(“ First Second Third “), will return “First Second Third”
Example 3: =trim(A2), will return “Mark Smith”
Example 4: =trim(A5), will return “Gene William Wilder”
Hopefully the few examples I listed above help you to understand how to use this formula and will save you some time the next time nothing seems to line up correctly. If you have any other questions please leave a comment below or contact me using the contact form.
** Excel Hints provides Excel Tips and Excel Help for All Levels of Experience.
More Excel Tips
3 Comments on this post
Trackbacks
-
Sarika Khurana said:
Hi there,
Is it possible to have a macro which auto trim all the cell within the selected cells.
thanks
November 28th, 2007 at 6:14 am -
Eliza said:
Hi there,
Once you do this formula, how can you delete the orginial cell? ie once I delete the orginal cell then the new one is deleted as well.
Regards,
Eliza
November 9th, 2009 at 6:18 pm -
john said:
Hi Eliza,
You will have to freeze the cell values after you do this if you plan on deleting the original cells. If you do a copy and paste special with values only selected, it will effectively freeze the cells.
Then you can either manually delete the original data, or right a macro to do it for you.
November 9th, 2009 at 6:42 pm
