If you are working on importing text files & and you want to remove spaces in Excel i.e. unnecessary spaces whether they are leading spaces in Excel or trailing spaces in Excel, then it is a must read article for you.
In this article, we will learn how to remove leading & trailing spaces in Excel.
Following is the snapshot of data:
- Text contains in column A has spaces in front & back.
- In order to remove leading spaces in Excel, we can use Excel TRIM function. However, TRIM in Excel does not remove trailing spaces in Excel.
- The formula is a combination of TRIM, CLEAN, SUBSTITUTE & CHAR functions.
- In cell B2, the formula is =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160),” “)))
In this way, Excel remove spaces which are not required.