Back to Blog

How to Remove Extra Spaces in Excel

D
David DeSouza
Dec 1, 2025
Illustration for How to Remove Extra Spaces in Excel

The Problem

Data copied from websites often comes with invisible spaces at the start or end (John), or double spaces in the middle (John Smith). This breaks VLOOKUPs and matching.

The Easy Way: Use SheetXAI

If you don't want to mess with formulas, the fastest way to do this is simply by asking.

With SheetXAI, you can open the sidebar and type:

Remove all extra spaces from column A.

SheetXAI will instantly write the formula or script for you and fill the cells. It handles the syntax so you can focus on the result.

The Manual Way: The Formulas You Need

To do this manually, you need to use: TRIM.

1. TRIM

Removes all spaces from text except for single spaces between words.

Syntax: =TRIM(text)

  • text: The text from which you want to remove spaces.

Example: =TRIM(" Hello World ") returns "Hello World".

Understanding the Logic

The logic is built entirely into the function. It handles leading, trailing, and multiple internal spaces automatically.

The Final Formula:

=TRIM(A2)

Conclusion

Now you know the "classic" way to solve this using formulas. It's a great skill to have.

But for those times when you just want the job done without the mental math, SheetXAI is there to help.

Boost your productivity today.
Start automating your spreadsheets.

Join thousands of professionals saving hours every week. No credit card required to start.

Learn more