Remove spaces in Excel using the TRIM Function
Posted by Roger Hyttinen on
Have you ever tried to search for data in your worksheet that you know for a fact is there, yet your query comes up with no results? If this happens, hidden spaces may be the culprit, especially if you've imported/received the data from an external source. Spaces have a way of sneaking in and creating difficulties (and endless frustration) in your formulas and in search queries.
The solution is the TRIM function. What this does, is removes any spaces at the beginning of a string or at the end of a string. Additionally, if there is more than once space between data within a string, it will replace all of those extra spaces, leaving only a single space behind.
The format of the TRIM function is: =TRIM(CELLRANGE). So if you wanted to remove extra spaces from cell A2, the formula would read:
=TRIM(A2)
This certainly is preferable to going through your worksheet and removing all of those spaces manually.
Looking for more Excel tips? Check out our new book Excel 2016:Up To Speed available as an ebook on Amazon, Kobo, and Apple iBooks