How to Remove Extra Spaces in Excel – Excel TRIM Function

  • Home
  • / How to Remove Extra Spaces in Excel – Excel TRIM Function

When you have to manage larger datasets, it could be an entirely tough task. And it becomes even more boring when you have to import a huge amount of data from any database. You definitely cannot operate such huge data manually, that’s why you need some tools and features to perform the task smoothly.

Removing extra spaces can irritate you in spreadsheets because it can mess up the entire sheet. Do you know extra spaces are counted as a character?

Yes, that’s why it can affect your results while performing any function. Extra Spaces become unwanted characters that you cannot afford because of their consequences. These spaces could be leading, trailing, or occurring in between words, numbers, or any text. In some cases, these extra spaces could appear with some characters that cannot be printed.

You can see the leading spaces and in-between values. However, both of them can be tricky to identify when your dataset is large enough. On the other hand, you cannot find the trailing spaces. So, the question here is, how to remove extra spaces in Excel?

What are these Spaces?

You can face any of the following spaces in your larger datasets.

Extra Spaces: we don’t need these spaces in our data and there is no limit to these spaces.

Leading Spaces: these spaces appear at the beginning of the text given in a cell

Trailing Spaces: these spaces appear at the end of the text in a cell

Spaces in-between Text: these spaces appear in word spacing where you don’t need a space or just a single space.

Line Breaks: these spaces are new lines that are added with ALT + Enter keys

Nonprinting Characters: these characters are usually added for content designing and not for displaying

When you start analyzing the dataset, identifying the text could be difficult as you can see “G” but you will not be able to find the text in the cell which is a “space character.” It often happens that’s why you need to learn some hacks to overcome this problem.

How to Remove Extra Spaces in Excel using TRIM Function?

With Excel, you can perform multiple tasks and operations. TRIM is a useful feature that Excel offers to remove unwanted spaces between texts. You can use this feature to remove excessive leading, trailing, and spaces in-between values. To find the trimmed values you will need a blank column.

Considering the following example, this has a combo of leading, trailing, and spaces in-between.

Add the function =TRIM(cell_numebr) to trim the extra spaces.

This function needs to be entered in the required cell or you can put it in the formula bar as well. remember that cell_number shows the place of the untrimmed text.

In cell A3, you will find the untrimmed value. Enter the formula =TRIM(A3) in the required cell or the formula bar. This procedure will trim value without considering leading, trailing, or in-between spaces. Enter the formula in the existing cells containing untrimmed spaces.

Now, you will see the trimmed values appear in the helper column. Copy and paste the trimmed values can replace untrimmed values. Right-click on the selected column to copy the trimmed values and select copy option. Use the paste special option when pasting and you will paste the trimmed spaces as values.

Also, note that other than spaces, there could be non-printable characters. The TRIM function removes the spaces and the CLEAN function removes non-printable characters in the text. Combo of these functions can remove both the spaces and the non-printable characters.

How to Remove Extra Spaces in Excel using Substitute Function?

If the spaces are linked with numbers or text, you can remove the spaces by using this method. A simple formula lets you remove all the spaces from the data. You will see the similarity between replacing feature and this feature. Enter the formula =SUBSTITUTE(A22,””,””) to trim the unwanted spaces. The spaces are replaced with (“”) and an empty string value is also replaced as (“”).

Final Thoughts

Trimming the extra spaces from the spreadsheet lets you make your data fully in control. The above-mentioned methods are super easy and effective. You must try at least once. Keep exploring Excel!

Write your comment Here