How to remove leading spaces in cells in Excel?
Sometimes there are some blank spaces before strings in cells, these spaces are called leading spaces. It must be arduous to remove leading spaces in cells one by one. Actually, there are several smart tricks that can help us remove leading spaces in cells conveniently and quickly. Suppose we paste some content from Microsoft Word with indent spaces, then it shows the leading spaces in each cell as the following screenshot shows.
The Trim function in Microsoft Excel can remove all spaces from text except for single spaces between words.
Step 1: Enter the formula =TRIM (A1) in the adjacent cell C1 and press the Enter key.
Step 2: Select cell C1 and drag the fill handle down to the range cell that you want to remove the leading space. Then you can see all cell content are extracted with all leading spaces removed. See screenshot:
You can replace the original content with the extracted ones by copying and pasting them as values.
This method is quite easy if you only need to remove leading spaces in contiguous cells within a row or a column. However, when you need to remove leading spaces in a range with several rows and columns, you have to use the function several times.
Quickly remove extra/leading/trailing spaces in Excel sheet
|Click for full-featured free trial in 60 days!|
|Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in full future 60 days.|
If you are experienced with Microsoft Excel, VBA macro is a better choice to remove the leading spaces in cells.
Step 1: Hold down the Alt + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
Step 2: Click Insert > Module, and paste the following macro in the Module window.
VBA: Remove leading spaces:
Sub RemoveLeadingSpace() 'Updateby20131129 Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) For Each Rng In WorkRng Rng.Value = VBA.LTrim(Rng.Value) Next End Sub
Step 3: Press the F5 key to run this macro. In the pop-up KutoolsforExcel dialog box, you need to select a range with leading space you want to remove, and then click the OK button. See screenshot:
Then you can see all leading spaces are moved from the selected range, see screenshots:
If you have Kutools for Excel installed, you can remove all leading spaces of cells in a selection conveniently and quickly by its Remove Spaces utility.
- 300+ powerful and easy-to-used functions,110,000+ Excel users'choice
- full-featured free trial in 60 days, no credit card required
- dozens of one-click functions to shrink your working time on solving complex problems
- includes functions to batch converion,deletion,combining sheets/cells,exproting, ect, free try now.
After installing Kutools for Excel, please do as below:（Free Download Kutools for Excel Now!)
Step 1: Select the range which you want to remove all leading spaces in cells.
Step 2: Click the Kutools > Text > Remove Spaces. See screenshot:
Step 3: In the Remove Spaces dialog box, check the Leading Spaces option in Spaces Type section, and then click the OK or Apply button. See screenshot:
Now all leading spaces are removed from the selected cells.
Kutools for Excel's Remove Spaces tool makes it possible to delete all kinds of spaces from strings in cells, including all extra spaces, leading spaces, trailing spaces, or all spaces.
|Remoev trailing spaces -- check Trailig spaces option|
|Remoev extra spaces -- check All excess spaces option|
|Remoev all spaces -- check All spaces option|
Tabbed browsing & editing multiple Excel workbooks/Word documents as Firefox, Chrome, Internet Explore 10!
You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Excel workbooks or Word documents in one Excel window or Word window, and easily switch between them by clicking their tabs. Click for free 45-day trial of Office Tab!
- Remove trailing spaces from cells
- Remove spaces between character and numbers within cells
- Remove leading and trailing spaces
- Remove indents within cells
Recommended Productivity Tools
Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.
Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!
300 New Features for Excel, Make Excel Much Easy and Powerful:
- Merge Cell/Rows/Columns without Losing Data.
- Combine and Consolidate Multiple Sheets and Workbooks.
- Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
- Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
- More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 26 days agoawesome sir...
To post as a guest, your comment is unpublished.· 2 months agoExcelente aportación
To post as a guest, your comment is unpublished.· 2 months agoTHANKS GUYS SAVED MY LIFE!!!!!
To post as a guest, your comment is unpublished.
To post as a guest, your comment is unpublished.· 7 months agoThanks for this wonderful article! hats off to your writing! great post with rich quality content! Very resourceful and informative! Keep posting! Would love to follow up on your upcoming future posts! Ninja Heroes Mod Apk