How to Remove Spaces in Cells in Excel

A big part of cleaning up data is removing spaces in cells with text. Usually, these spaces are imported when text is copied or pasted in Excel. Luckily, there is an easy function that you can use to remove leading and trailing spaces in cells with text. This function is called TRIM.

use the TRIM function to clean up cell spaces

How to Remove Leading and Trailing Spaces

The Trim function eliminates spaces from text in an Excel cell.  This function can also remove spaces between spaces in newer versions of Excel. For example, let’s evaluate how it removes leading and trailing spaces.; the word “character” has spaces before and after the word in the first to examples.  Using TRIM(text) will clean the spaces from the text.

Trim function eliminates spaces before and after a word in EXCEL

Using the trim function will help you eliminate the spaces. Simply type = TRIM and enter your cell reference. See the example below:

=TRIM(A2)

The trim function is very good an removing spaces in cells

Trim also allows you to remove spaces in the middle of text

The trim function can also remove text in the middle of your text string. See the image below for a quick demonstration.

The Trim function can remove space from before and after a text string.

What do you do when you have broken line text?

When you have a broken line. You can also use TRIM to eliminate unwanted spaces in cells.

TRIM can remove broken lines easily

Learn How To:

Remove Blank Rows