Title: Remove Leading and Trailing Spaces - Free Excel Tutorial
Headings: Remove Leading and Trailing Spaces
Remove Leading and Trailing Spaces
Method 1: Remove Leading and Trailing spaces with Excel Formula
Method 2: Remove Leading and Trailing spaces with Excel VBA macro
Related Functions

Content: A4, you can refer to the following two methods to achieve it. Method 1: Remove Leading and Trailing spaces with Excel Formula
To remove leading and trailing spaces from text string in Cells, you can use the TRIM function to remove extra spaces. So you can type the following formula in Cell B1, then press Enter key. = TRIM (A1)
Then select Cell B1 and drag the AutoFill Handle down to other cells that you want to remove the leading or trailing spaces. You will see that all of your leading and trailing spaces in range A1: A4 are cleaned up. Note: if the text contains non-braking spaces, this formula will not work, because the TRIM function is not able to remove non-breaking spaces. At this time, you should remove the non-breaking spaces firstly with the SUBSTITUTE function, and then use the TRIM function to remove the rest leading and trailing spaces.