Tuesday, August 2, 2016

Excel - Remove leading and trailing spaces from text

You may need to remove extra spaces before, after or sometimes in between text. Extra spaces can happen when you have copied and pasted from another application into Excel.


I have a list of books I have read that I was keeping in OneNote. I copied the information over to Excel and this is what I got:

untrimmed
I can use the TRIM function to get rid of those extra spaces. TRIM removes unwanted spaces in your text, except single space in between words.

=TRIM(this is the cell that you want all those extra spaces removed from).

=TRIM(A1)
=TRIM(A1)
Extra spaces aren’t always this easy to spot, especially those at the end. An unseen extra space can cause problems. TRIM is a great Text function that helps with data cleansing.