Remove Leading Spaces in Excel

Article byJeevan A Y
Edited byAshish Kumar Srivastav
Reviewed byDheeraj Vaidya, CFA, FRM

How to Remove Leading Spaces in Excel Cell?

In Excel, unwanted space characters often take considerable time to clean and make the data perfect. One of the biggest problems with these unwanted leading spaces in Excel cells is that we cannot simply recognize a space in it. It adds to the misery.

#1 – Remove Unwanted Leading Spaces in Excel Cell Using TRIM Function

Let us start.

  1. Yes, you could argue why we don’t replace space with anything. But the problem is it will also replace all the necessary spaces. For example, look at the below sentence in a cell.


    Remove Space Example 1

    In the above sentence, we need one space character after each completed word to make the sentence proper. We have only one extra space after the word “Capital.”

  2. To deal with these unwanted space problems, we have a built-in function called TRIM in Excel, which can remove all the unwanted spaces in the Excel cells.


    Trim Formula

  3. The syntax is very simple. We need to select the required cell to be trimmed. The TRIM function removes all the spaces except the single space after each word. Let us apply the TRIM formula in Excel to remove all kinds of spaces in a cell.


    Remove Space Example 1-1

  4. This TRIM function removed the spaces between “Capital” and “is.”


    Remove Space Example 1-2

–>> If you want to learn Excel and VBA professionally, then ​Excel VBA All in One Courses Bundle​ (35+ hours) is the perfect solution. Whether you’re a beginner or an experienced user, this bundle covers it all – from Basic Excel to Advanced Excel, Macros, Power Query, and VBA.

#2 – Remove Non-Breaking Leading Spaces in Excel Cell

It is very easy to remove normal leading spaces in the Excel cell. However, the TRIM function goes wrong in the case of non-breaking leading spaces. For example, look at the below image.

Remove Space Example 2

Even after the TRIM function is applied, we do not see the perfect sentence here. It is a problem with non-breaking leading spaces in an Excel cell.

Non-Breaking Leading Spaces in Excel Cell usually comes when we download the data from a web made up of the character CHAR (160). Therefore, we must use TRIM and SUBSTITUTE excel functionsSUBSTITUTE Excel FunctionSubstitute function in excel is a very useful function which is used to replace or substitute a given text with another text in a given cell, this function is widely used when we send massive emails or messages in a bulk, instead of creating separate text for every user we use substitute function to replace the information.read more in these cases together.

Firstly, open the TRIM function.

Remove Space Example 2-1

Now, apply the SUBSTITUTE function.

Remove Space Example 2-2

We need to select the text now, so select the A4 cell as the reference.

Remove Space Example 2-3

What is the old text we need to remove here? The old text is CHAR (160).

Remove Space Example 2-4

New text to be a substitute is nothing, so mention double quotes (“).

Remove Space Example 2-5

Close the bracket and press the “Enter” key. We will get a proper sentence now.

Remove Space Example 2-6

This way, we can deal with breaking spaces in the Excel cell. If the TRIM function cannot give accurate results, use this technique.

#3 – Remove Double Spaces Using Excel FIND & REPLACE Method

We can remove double spacesRemove Double SpacesWhile importing or copy-pasting the data from an external source, extra spaces are also copied in Excel. This makes the data disorganized and difficult to be used. The purpose of removing unwanted spaces from the excel data is to make it more presentable and readable for the user. read more in cells using the Excel find and replaceExcel Find And ReplaceFind and Replace is an Excel feature that allows you to search for any text, numerical symbol, or special character not just in the current sheet but in the entire workbook. Ctrl+F is the shortcut for find, and Ctrl+H is the shortcut for find and replace.read more method. For example, assume below is the data we have in Excel.

Remove Space Example 3

Here, we have a first name and last name together. After the first name, we have two spaces instead of one space. Instead of the TRIM function, we can use the find and replace method in these cases.

Step 1: Select the required area’s double space to be removed.

Remove Space Example 3-1

Step 2: Now, press “CTRL + H.”

Shortcut for Find & Replace

You will see below the “Find and Replace” window.

Remove Space Example 3-2

Step 3: Type two space characters in the “Find what:” box.

Remove Space Example 3-3

Step 4: Now, in the “Replace with:” type only one space character.

Remove Space Example 3-4

Step 5: Now, click on “Replace All.

Remove Space Example 3-5

Step 6: Excel will show you how many replacements it has made.

Remove Space Example 3-6

Step 7: It has removed all the double spaces in the Excel cell and replaced them with a single space. So, we have proper names now.

Remove Space Example 3-7

#4 – Remove All Leading Spaces Using Excel FIND & REPLACE Method

Assume you are working with numbers. You have many spaces between the numbers, as shown in the image below.

Example 4

We have abnormal Excel leading spaces between, before, and after the numbers. In these cases, we need to remove all the spaces. So use the “Find and Replace” method.

  • Step 1: Select the data first.
Example 4-1
  • Step 2: Press “Ctrl + H” and type a single space in the “Find what:” box.
Example 4-2
  • Step 3: Do not insert anything in the “Replace what:” box. Just click on “Replace All.”
Example 4-3
  • Step 4: It will remove all the leading spaces in the Excel cell. We have numbers in order now.
Example 4-4

Things to Remember

This article is a guide to Remove Leading Spaces in Excel Cell. Here, we discuss how to remove leading spaces in Excel along with practical examples and a downloadable Excel template. You may learn more about Excel from the following articles: –