EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Certification Courses
  • 120+ Courses All in One Bundle
  • Login

Excel Remove Leading Spaces

By Madhuri ThakurMadhuri Thakur

Home » Excel » Blog » Excel Tips » Excel Remove Leading Spaces

Remove Leading Spaces in Excel

Excel Remove Leading Spaces (Table of Contents)

  • Remove Leading spaces in Excel
  • How to Remove Leading Spaces in Excel?

Remove Leading Spaces in Excel

While working in Excel, we frequently use the spaces for each word. There are different spaces in excel which we may not observe while working in Excel. Different spaces available are Leading spaces/Trailing spaces, additional spaces, and line breaks in Excel.

Start Your Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

How to Remove Leading Spaces in Excel?

In this article, first, we will see how to identify spaces between cells. These spaces may create a problem while working with formulas in Excel.

You can download this Remove Leading Spaces Excel Template here – Remove Leading Spaces Excel Template

We will see a few examples where it causes a problem. We will use formulas and functions to remove spaces in Excel.

Example #1

Consider a sheet that has data of student names and roll numbers as below.

Student's Data Sheet

Now we will apply Vlookup for the first table to find the Roll numbers from the second table. The results will be like the below screenshot after we apply the Vlookup.

Remove Leading Spaces Example 1-2

You may doubt why we are discussing Vlookup now. Now apply the same Vlookup by adding the spaces before the name and check whether the Vlookup is working or not. Observe the below screenshot; for the names “Kiran” and “Kumar “, we gave spaces; hence the roll number is coming as N/A for both student names.

Remove Leading Spaces Example 1-3

This is because due to the spaces at the beginning of the names. Now we have seen the problem is due to the space available in the beginning.

Popular Course in this category
Sale
Excel Training (21 Courses, 9+ Projects)21 Online Courses | 9 Hands-on Projects | 110+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.9 (10,985 ratings)
Course Price

View Course

Related Courses
Excel Data Analysis Training (15 Courses, 8+ Projects)Excel for Finance Training (18 Courses, 7+ Projects)

Example #2

Now we will check if space after the name will cause any problem while applying formulas. We will keep the space after the names “Kiran” and “Rajesh” why I am mentioning the names because we cannot identify if space is available after the name.

To know the number of spaces available, we can use the formula length and can find. Observe the below screenshot. I have applied the LEN formula for the same names in both the tables, but the length is different in both the tables.

In the first table, we have given space after the name; hence length is 7 for the same names, and in the second table, it is 6. I hope you understand how the spaces will affect the formula and how to find whether spaces are there or not.

Remove Leading Spaces Example 2-1

Example #3

If space is there in the beginning and space is thereafter now, we will see if the space is available in between two words.

Remove Leading Spaces Example 3-1

If we observe, there is space between every word, and I have also given the length for those two names. We will add one more space in between the names then we will see whether Vlookup will give results.

Remove Leading Spaces Example 3-2

I added the space for “Rachel Green” in the first table and “Virat Singh” in the second table. Because of that, two of them giving the results as “N/A”. I hope you understand how spaces are creating errors while working with formulas in excel.

Example #4 – Using TRIM Function

The fast and easy way to remove spaces in excel is using the TRIM function. Now we will apply the Trim function and will check the length of the words.

Consider the below table with different types of spaces between A and B.

Remove Leading Spaces Example 4-1

In the first line, only one space is given between A and B under the Alphabet column, and the length of that cell is 3 because it has two characters and one space. The second line has three spaces in between A and B and one space after B; hence the length of that cell is 6, and the final cell is given multiple spaces before A, in between A and B, and after B.

Remove Leading Spaces Example 4-2

Now apply the “Trim” function to remove the additional spaces between A and B. We can observe the formula bar, which is marked with an arrow mark. If we observe the column with the name “After trim” has A and B in the same way in all the 3 cells, this is because the Trim function removes the additional spaces between A and B. The length of the column after the trim is 3 for all the cells.

Remove Leading Spaces Example 4-3

If we observe the trim function left only one space between A and B but removes the additional spaces between A and B, before and after A and B. So, with the help of the Trim function, we cannot remove entire spaces between the words except additional spaces.

Example #5 – Removal of All Spaces in Excel

As we are unable to remove all spaces using Trim, we can use the substitute function to remove all the spaces in the cell.

Consider the below table where there are spaces available in both the cells; however, the excel user do not want any spaces.

Data with Space

First, apply the Trim function and check.

Using Trim Function

Observe the results after applying a trimming function. Still, there is a space between – and 5 in the first row, and there is a space between 6 and / in the second row. The length of cells after the trim is 7.

Now apply the Substitute function and check the lengths. Substitute function is used to replace one text with another text. Here we need to replace space with no space or null. Observe the format of the substitute function in the below screenshot.

Remove Leading Spaces Example 5-3

As per the above screenshot in “Text”, we selected the cell address as A2, and “Old_text” is space; hence given space between double quotes, and “new_text” is null; hence we were just given double quotes without space.

Substitute Function

Follow the same steps for other cell and check the length of the results from the substitute; it is 6 for both the cells, which means there is no space available in both the cells.

Remove Leading Spaces Example 5-5

Example #6 – Remove Line Breaks in Excel

In case if your Excel has line breaks in the same cell, there are two different lines, as shown in the screenshot below.

Line Breaks

Observe “I love” in one line and “dogs” in the next line but belong to the same cell A1. If we want to remove the line breakages like this, we can use the “Clean” function without removing the additional spaces.

Using Clean Function

Things to Remember

  • Additional spaces in excel will create disturbances while applying formulas in Excel.
  • There are different spaces like Leading/Trailing/In-between.
  • The trim function helps remove all the additional spaces, but it will not remove only one space between words or letters.
  • If we want to remove all the spaces, we can use the Substitute function.
  • If there are any line breaks, we can use the Clean function, but it will not remove additional spaces but just remove line breaks.
  • We can also use find and replace to remove spaces.

Recommended Articles

This has been a guide to Remove Leading Spaces in Excel. Here we discussed How to Remove Leading Spaces in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. VLOOKUP Function in Excel
  2. SUBSTITUTE in Excel
  3. TRIM in Excel
  4. Excel CLEAN Function

All in One Excel VBA Bundle (120+ Courses, 30+ Projects)

120+ Online Courses

30+ Projects

500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Excel Functions
  • Excel Tips
    • Recover Document in Excel
    • Excel Shortcut to Select Row
    • Excel Header Row
    • Excel Insert Button
    • Excel Translate
    • Budget in Excel
    • KPI Dashboard in Excel
    • Blank Invoice Excel Template
    • Write Formula in Excel
    • Auditing Tools in Excel
    • Autofit Row Height in Excel
    • Formatting Text in Excel
    • Add Rows in Excel Shortcut
    • Divide Cell in Excel
    • Compare Two Columns in Excel for Matches
    • Excel Troubleshooting
    • Unprotect Excel Workbook
    • Subtract Date in Excel
    • Carriage Return in Excel
    • Negative Numbers in Excel
    • Worksheets in Excel
    • Excel Match Multiple Criteria
    • Exponential Moving Average Formula
    • Sentence Case in Excel
    • Excel Reverse Order
    • Excel Timesheet Template
    • Weighted Average in Excel
    • CTRL Shift-Enter in Excel
    • Excel Expense Tracker
    • INDEX MATCH Function in Excel
    • Percent Change in Excel
    • Drag and Drop in Excel
    • Shade Alternate Rows in Excel
    • Excel Database Template
    • Inverse Matrix in Excel
    • New Line in Excel Cell
    • Format Cells in Excel
    • Excel Text with Formula
    • Project Management Template in Excel
    • Vlookup vs Index Match
    • Embedded in Excel
    • Count Colored Cells in Excel
    • Excel Hacks
    • Column Header in Excel
    • Database Function in Excel
    • Excel Spell Check
    • Linear Interpolation in Excel
    • Convert Excel to CSV
    • Excel Not Responding
    • Delta Symbol in Excel
    • Excel Mortgage Calculator
    • Excel Show Formula
    • Break Links in Excel
    • VLOOKUP Examples in Excel
    • Alternate Row Color Excel
    • Checklist in Excel
    • Microsoft Office Tips
    • Excel vs Access
    • Excel Change Case
    • Count Characters in Excel
    • Formula Bar in Excel
    • Invoice Template in Excel
    • Find and Replace in Excel
    • PowerPivot in Excel
    • Wildcard in Excel
    • Line Break in Excel
    • NULL in Excel
    • Text Formula in Excel
    • Family Tree in Excel
    • Insert Calendar in Excel
    • Page Setup in Excel
    • Search For Text in Excel
    • Switching Columns in Excel
    • 3D Cell Reference in Excel
    • Roadmap Template in Excel
    • Cell References in Excel
    • Excel Automation
    • Matching Columns in Excel
    • Evaluate Formula in Excel
    • How to Find Mean in Excel
    • How to Add Cells in Excel
    • Project Timeline in Excel
    • TODAY Formula in Excel
    • Poisson Distribution in Excel
    • YEAR Formula in Excel
    • REPLACE Formula in Excel
    • Create Spreadsheet in Excel
    • SEARCH Formula in Excel
    • HYPERLINK Formula in Excel
    • Pivot Table with Multiple Sheets
    • COLUMNS Formula in Excel
    • DAY Formula in Excel
    • RIGHT Formula in Excel
    • INDIRECT Formula in Excel
    • Excel IRR Formula
    • Pivot Table Sort
    • OR Formula in Excel
    • Pivot Table Formula in Excel
    • How to Edit Drop Down List in Excel?
    • WEEKDAY Formula in Excel
    • Chart Wizard in Excel
    • Time Difference in Excel
    • Lookup Table in Excel
    • SUBTOTAL Formula in Excel
    • LOOKUP Formula in Excel
    • Themes in Excel
    • Group Worksheets in Excel
    • Excel ISNUMBER Formula
    • 3D Maps in Excel
    • VLOOKUP Tutorial in Excel
    • Moving Columns in Excel
    • Grouping Columns in Excel
    • Excel Formula of Percentage
    • Excel Leading Zeros
    • Timesheet in Excel
    • Nested IF Formula in Excel
    • SUMIF Formula in Excel
    • Concatenation in Excel
    • Excel Insert Page Break
    • LEN Formula in Excel
    • Insert Comment in Excel
    • Excel Print
    • Fractions in Excel
    • Excel Add a Column
    • Borders in Excel
    • Excel Sum by Color
    • Excel vs Google Sheets
    • Calculate Percentage Increase in Excel
    • Excel Format Phone Numbers
    • Excel Search Box
    • Excel vs CSV
    • Excel vs Numbers
    • Excel Concatenate Date
    • Excel Bullet Points
    • Calculate Compound Interest in Excel
    • Find External Links in Excel
    • Excel Comma Style
    • Excel Remove Leading Spaces
    • Combine First and Last Name in Excel
    • How to Calculate Ratio in Excel
    • SUMPRODUCT Function with Multiple Criteria
    • Create Excel Template
    • Excel Greater than or Equal
    • Excel Keyboard Shortcuts
    • Excel Row vs Excel Column
    • Excel Operators
    • Excel Text Compare
    • Excel Uppercase Function
    • Excel Auto Numbering
    • Watermark in Excel
    • Excel Delete Row Shortcut
    • Excel Word Count
    • Row Count in Excel
    • Excel Grade Formula
    • Excel Percentage Difference
    • Excel Rows and Columns
    • Excel Group
    • Excel Move Columns
    • Excel Row Height
    • Excel Sparklines
    • Excel Drawing a line
    • Multiple IFS in Excel
    • Excel Strikethrough
    • Numbering in Excel
    • Share Excel Workbook
    • Excel Shortcut For Merge Cells
    • Excel OneDrive
    • Excel Track changes
    • Excel Hide Formula
    • Excel Filter Shortcuts
    • Excel 3D Reference
    • Protect Excel Workbook
    • Excel Moving Averages
    • Excel Row Limit
    • Excel Absolute Value
    • Excel Print Area
    • Excel Format Painter
    • Excel Separate text
    • Excel Autofit
    • Excel Columns to Rows
    • Excel Paste Shortcut Option
    • Excel Rows to Columns
    • Excel Insert Row Shortcut
    • Excel Extensions
    • Excel Unmerge Cells
    • Divide in Excel Formula
    • Excel Compare Two Columns
    • Not Equal To Excel
    • Excel Remove Duplicates
    • Excel Remove Spaces
    • Excel Calculate Age
    • Copy Excel Sheet
    • Excel Conditional Formatting Based on Another Cell Value
    • Excel Cell Reference
    • Excel Split Cell
    • Excel Circular Reference
    • Highlight Every Other Row in Excel
    • Errors in Excel
    • Excel Delete Pivot Table
    • Excel Pivot Table
    • Subtraction in Excel
    • Count Unique Values in Excel
    • Excel Highlight Duplicates
    • Excel Data Formatting
    • Random Numbers in Excel
    • Basic Excel Formulas
    • Page Numbers in Excel
    • Excel CAGR Formula
    • Excel Combine cells
    • IFERROR with VLOOKUP in Excel
    • Column Sort in Excel
    • Print Comments in Excel
    • Cheat Sheet of Excel Formulas
    • Remove Hyperlinks in Excel
    • Excel Drop Down List
    • Remove (Delete) Blank Rows in Excel
    • Relative Reference in Excel
    • Subscript in Excel
    • Superscript in Excel
    • Excel Insert Multiple Rows
    • Excel Absolute Reference
    • Unhide Columns in Excel
  • Excel Functions (12+)
  • Excel Tools (114+)
  • Financial Functions in Excel (17+)
  • Logical Functions in Excel (14+)
  • Lookup Reference Functions in Excel (34+)
  • Maths Function in Excel (47+)
  • TEXT and String Functions in Excel (26+)
  • Date and Time Function in Excel (23+)
  • Statistical Functions in Excel (58+)
  • Information Functions in Excel (4+)
  • Excel Charts (56+)
  • Workplace Productivity (4+)
  • Microsoft Office Tools (15+)
  • Excel Formula and Functions (21+)
  • MS Excel Shortcuts (4+)
Excel Functions Courses
  • EXCEL COURSE
  • Online Excel Data Analysis Course
  • Excel for Finance Course
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Excel Charts
  • Excel Tips
  • All Tutorials
Certification Courses
  • All Courses
  • Excel VBA Course - All in One Bundle
  • VBA Course
  • Excel Data Analysis Course
  • Excel for Marketing Course
  • Excel for Finance Course
  • Excel for HR Training

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

Download Remove Leading Spaces Excel Template

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Special Offer - EXCEL COURSE Learn More