Excel Trim Formula

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”

Trim Formula

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.

 Subscribe to Excel Hints




1 Comment so far

  1. Sarika Khurana on November 28th, 2007

    Hi there,

    Is it possible to have a macro which auto trim all the cell within the selected cells.

    thanks

Leave a reply

You must be logged in to post a comment.