How to Use the TRIM Function in Excel

Metaverse News

Extra spaces in a cell can be a nuisance. Luckily, a simple function can get rid of all the extra spaces in your Excel sheet. Read on to learn to use the TRIM function and trim your datasheet.

What Is Excel’s TRIM Function?

With the TRIM function in Excel, you can remove extra spaces in a cell, leaving only the necessary spaces between each word. The function takes a string of text and returns a string of text, but the output string is not surrounded by leading or trailing spaces, neither are there any extra spaces between words.

It’s a good idea to clean out extra spaces if you have imported text into your Excel spreadsheet. In a sentence, extra spaces can occur between words, or at the beginning and end.

Related: Ways to Organize Your Spreadsheets in Excel

How to Use the TRIM Function

You can feed the TRIM function the text string itself, or indicate a cell or a range of cells to be fed to it. Let’s see this function at work with a simple example.

=TRIM (text)

In the example below, we have three cells in the A column containing the same sentence. The difference between these sentences is the spaces used in them: Cell A1 is standard, cell A2 has leading and trailing spaces, and finally, cell A3 has extra spaces between words as well as leading and trailing spaces.

The goal is to trim the extra spaces in these sentences and display the results in the C column. A good method to do this is to insert the formula for cell C1 and then use the fill handle to extend it to the other cells.

  1. Select cell C1 and in the formula bar, enter the formula below:
     =TRIM(A1)
  2. Press Enter. You can now see the string from cell A1 appear in cell C1. There won’t be any differences since the A1 string was standard.
  3. Grab the fill handle and drag it over cells C2 and C3.
  4. The TRIM function will trim the strings and display them without the extra spaces in the C column.

Trim Your Strings

The TRIM function removes extra spaces from your cells, leaving only a single space between the words and none before and after it. A neat string could be just what you need as input for other sophisticated formulas.

To maximize your Excel productivity, aside from the TRIM function, there are some other useful Excel functions that you should learn.

MUO – Feed