How To Get Rid Of Spaces In Excel

Use the substitute function to remove all spaces or non breaking spaces.
How to get rid of spaces in excel. The trim function below removes 2 leading spaces 3 extra spaces and 2 trailing spaces. To get the length of a string use the len function. Trim clean text the clean function removes a range of non printing characters including line breaks and returns cleaned text. Remove all extra spaces from strings with the trim function 2 steps remove extra spaces from strings.
The trim function then takes over to remove extra spaces and returns the final text. You could then copy the results of this formula and use paste special to paste the values back into whatever cells you desire. For instance if you want to get rid of the spaces from the cells in column d you could use the following formula. This method is quite easy if you only need to remove.
Now in the cell h4 let s apply a trim function. The excel trim function removes all spaces from text except a single space between words. If you also need to remove line breaks from cells you can add the clean function like so. Press enter key to get the result then drag auto fill handle over the cells you want to remove extra spaces.