How to Remove Spaces in Excel (with Examples)

Microsoft Excel is a powerful spreadsheet tool used for various data manipulation tasks.

One common task is cleaning up data, and removing spaces is often part of this process.

Extra spaces in your Excel data can lead to errors and inconsistencies.

In this tutorial, we'll explore different methods to remove spaces in Excel, along with practical examples to help you master this essential skill.

1. Types of Spaces in Excel

Before we start learning how to remove spaces in Excel, it's important to know that there are different kinds of spaces you might find.

  • 1. Regular Space: The standard space character, often created by pressing the spacebar.

  • 2. Non-breaking Space (NBSP): A space that prevents line breaks, typically used in web content.

  • 3. Zero-width Space (ZWSP): A space character that does not have a visible width.

  • 4. Non-breaking Hyphen (NBHY): Similar to NBSP but for hyphens.

  • 5. En Space and Em Space: Spaces of varying widths used in typography.

Knowing the types of spaces you're dealing with will help you choose the appropriate method for removal.

2. Remove Spaces Using Excel Function

Excel provides several functions to remove spaces from your data. Let's explore some of the most commonly used ones.

2.1 TRIM Function:

The TRIM function in Excel removes all leading and trailing spaces and reduces multiple spaces between words to a single space.

=TRIM(text)

2.2 CLEAN Function:

The CLEAN function removes non-printable characters, including certain types of spaces, from text.

=CLEAN(text)

2.3. SUBSTITUTE Function:

The SUBSTITUTE function in Excel allows you to replace specific characters, including spaces, in a text string with other characters or nothing.

=SUBSTITUTE(text, old_text, new_text, [instance_num])

3. Advanced Methods for Space Removal

Sometimes, you might need more advanced methods to tackle spaces in Excel data. Here are a couple of techniques:

3.1. Using Find and Replace:

The Find and Replace feature is versatile and can handle various space types.

Steps:
  • 1. Press Ctrl + H to open the Find and Replace dialog box.

  • 2. In the "Find what" field, type the space character(s) you want to remove.

  • 3. Leave the "Replace with" field empty to remove the spaces.

  • 4. Click "Replace All" to remove all instances of the specified space.

3.2. Text to Columns:

This Text to Column method is useful when you have text with spaces you want to split into separate columns.

Steps:
  • 1. Select the cells containing the text.

  • 2. Go to the "Data" tab.

  • 3. Click "Text to Columns."

  • 4. Choose "Delimited" and click "Next."

  • 5. Select the delimiter (space in this case) and click "Next."

  • 6. Choose the destination for the split text and click "Finish."

4. Examples

4.1 Remove Spaces Between Words:

Suppose you have a list of names in an Excel column, but there are extra spaces between the first and last names.

You want to remove these extra spaces to make the names consistent.

To remove spaces between words, you can use the SUBSTITUTE function:

Apply this formula to the entire column, and you'll get the cleaned-up names without spaces between words:

How to Remove Spaces Between Words in Excel

4.2 Remove Spaces in Excel After Text:

Suppose you have a column of product codes, and some of them have extra spaces at the end. You want to remove these trailing spaces.

To remove spaces after the text, you can use the TRIM function:

Apply this formula to the entire column, and you'll get the product codes without trailing spaces:

How to Remove Spaces in Excel After Text

4.3 Remove Spaces in Excel Before Text:

Suppose you have a column of account numbers, and some of them have extra spaces at the beginning. You want to remove these leading spaces.

To remove spaces before the text, you can use a combination of functions, such as TRIM and RIGHT:

Apply this formula to the entire column, and you'll get the account numbers without leading spaces:

How to Remove Spaces in Excel Before Text

4.4 Remove Spaces Between Numbers:

Suppose you have a column with numerical values, but some of them have spaces between digits.

You want to remove these spaces to have consistent numeric data.

To remove spaces between numbers, you can use the SUBSTITUTE function.

Apply this formula to the entire column, and you'll get the numeric values without spaces between digits.

How to Remove Spaces Between Numbers in Excel

These examples demonstrate how you can remove different types of spaces in Excel to clean up your data and make it more consistent for further analysis or presentation.

Conclusion

Removing spaces in Excel is a fundamental skill for data cleaning and manipulation.

This tutorial has covered various methods, from simple functions like TRIM and SUBSTITUTE to more advanced techniques like Text to Columns and Find and Replace.

Remember to be aware of the types of spaces you are dealing with and choose the appropriate method accordingly.

Regularly cleaning up your data will not only make it more presentable but also help prevent errors in your calculations and analyses.

Excel provides you with a robust set of tools to manage spaces in your data efficiently.

By mastering these techniques, you'll become more proficient in working with Excel and handling data effectively.


Download


Get Your FREE Excel Shortcut Keys e-BOOK