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: The TRIM function will remove all extra spaces including leading space, trailing spaces and the extra spaces between words. If you want to remove leading spaces only, please go to Method B. If you want to remove leading spaces only, or trailing spaces only, or want to remove all excess spaces including non-printing characters, please go to method C.

13 Text tools You Must Have in Excel Which Will Boot Your Efficiency By 90%
▲ Batch edit text string in cells, such as adding same text to cells at once, remove characters at any position and so on. ▲ Except tools displayed in picture, there are 200 advanced tools else in Kutools for Excel, which can solve your 82% Excel puzzles. ▲ Become an Excel expert in 5 minutes, gain people's recognition and promotion. ▲ 110000+ high efficiency people sand 300+ world renowned companies' choice. 60-days free trial, no credit card require
Download Now
Method B: Remove leading spaces from strings with the VBA code (5 steps)
If you want to convert or import all data in Word document to Excel, you can use VBA code. 1. Press Alt + F11 key to enable Microsoft Visual Basic for Applications window. 2.