Title: How to remove leading and trailing spaces in Excel cells?
Headings: How to remove leading and trailing spaces in Excel cells?
How to remove leading and trailing spaces in Excel cells?
Method A: Remove all extra spaces from strings with the TRIM function (2 steps)
Remove extra spaces from strings
=TRIM (B2)
Tip:
Remove all excess spaces including non-printing characters and non-breaking space
=TRIM (CLEAN (SUBSTITUTE (B2,CHAR (160)," ")))
Note:
Method B: Remove leading spaces from strings with the VBA code (5 steps)
1. Press Alt + F11 key to enable Microsoft Visual Basic for Applications window.
VBA: Deleting leading spaces from string
Note:
Method C: Remove leading/trailing/extra/all spaces as you need with Kutools (3 steps)
Remove Leading Spaces only:
Remove Trailing Spaces only:
Remove Leading & Trailing Spaces only:
Remove All Excess Spaces:
Remove All Spaces:
Demo: Remove Spaces
Download sample file
Other Operations (Articles) Related To File Conversion
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
Office Tab - brings tabbed interface to Office, and make your work much easier

Content: Method A: Remove all extra spaces from strings with the TRIM function (2 steps)
Remove all excess spaces including extra space, leading and trailing space
Method B: Remove leading spaces from strings with the VBA code (5 steps)
Remove only first space, need have a copy before running code
Method C: Remove leading/trailing/extra/all spaces as you need with Kutools (3 steps)
Remove leading/trailing/extra/all spaces as you need
Download sample file
This sample file contains all data this article need
Other Operations (Articles) Related To Spaces
Count space before text string Find position of nth space So on..
Method A: Remove all extra spaces from strings with the TRIM function (2 steps)
Remove extra spaces from strings
1. Select a cell next to the cell you want to remove extra spaces from string, type this formula
=TRIM (B2)
B2 is the cell you want to remove spaces from, See screenshot: 2. Press Enter key to get the result then drag auto fill handle over the cells you want to remove extra spaces from, all of leading spaces and trailing spaces and extra spaces have been removed. Tip: 1.