How to Remove Spaces in Excel After Text: A Step-by-Step Guide

Removing spaces in Excel after text can be a pesky problem, but it’s actually quite simple to fix. By using Excel’s built-in TRIM function, you can quickly and easily get rid of any extra spaces that are hanging around where they don’t belong. This function tidies up your data by removing any spaces at the beginning or end of your text entries. So, let’s get those spreadsheets looking neat and professional in no time!

Step by Step Tutorial to Remove Spaces in Excel After Text

Before we dive into the steps, let’s talk about what we’re going to achieve. Using the TRIM function, we’ll remove all the unnecessary spaces that follow our text in Excel cells. This will leave us with clean, evenly formatted data that’s easier to work with. Ready? Let’s go!

Step 1: Select the Cell or Range of Cells

Click on the cell or highlight the range of cells where you want to remove the spaces.

In Excel, you can select a range of cells by clicking and dragging your mouse over the cells you want to include. Alternatively, you can click on the first cell, hold down the Shift key, and then click on the last cell in the range to select everything in between.

Step 2: Type =TRIM(

After selecting your cell(s), type =TRIM( into the formula bar.

The TRIM function is one of Excel’s text functions. When you start typing a function into the formula bar, Excel will often show a drop-down list of functions that match what you’ve typed so far. You can click on TRIM from this list or continue typing it out manually.

Step 3: Reference the Cell with the Text

Click on the cell that contains the text from which you want to remove spaces, or type in the cell’s reference.

By referencing the cell, you’re telling the TRIM function which text you want to clean up. You can type the cell reference, like A1, directly after =TRIM(, or you can click on the cell and Excel will insert the reference for you.

Step 4: Close the Function

Type a closing parenthesis ) and press Enter to complete the function.

Closing the function tells Excel that you’re done entering your TRIM formula. Once you press Enter, the cell will display the cleaned-up text, free of those pesky trailing spaces.

Step 5: Copy the Function to Other Cells (Optional)

If you need to remove spaces from other cells, copy the TRIM function to those cells.

You can do this by clicking on the cell with the TRIM function and dragging the small square in the bottom-right corner (the fill handle) down or across to fill other cells. Alternatively, you can use Ctrl+C and Ctrl+V to copy and paste the function.

After completing the above steps, your Excel cells should now be free of any unwanted spaces after your text. This will make your data look cleaner and can help prevent errors when sorting, searching, or calculating within your spreadsheet.

Tips to Remove Spaces in Excel After Text

  • Use the TRIM function to remove extra spaces at the beginning and end of a cell’s text content, not just after the text.
  • If you have a large dataset, use the fill handle to quickly apply the TRIM function to multiple cells at once.
  • Remember that the TRIM function will not remove single spaces between words, only extra spaces.
  • For removing all spaces, including between words, consider using the SUBSTITUTE function with a space character as the old text and an empty string as the new text.
  • To permanently replace the original text with the trimmed version, use the Paste Special feature to paste values over the original data after using the TRIM function.

Frequently Asked Questions

What is the TRIM function in Excel?

The TRIM function in Excel is used to remove extra spaces from text. It gets rid of spaces at the start and end of a text string and extra spaces between words.

Can the TRIM function remove all spaces in Excel?

No, the TRIM function only removes extra spaces. It won’t remove single spaces between words. For that, you would need to use a different function, like SUBSTITUTE.

Does the TRIM function work on text with multiple lines in a cell?

Yes, it does! The TRIM function can handle text that spans multiple lines within a cell and will remove any extra spaces at the beginning or end of each line.

Can I use the TRIM function on numbers or dates?

While the TRIM function is designed for use with text, numbers and dates in Excel are often formatted as text behind the scenes. So, if your numbers or dates have spaces, TRIM can help clean them up too.

What if the TRIM function doesn’t remove the spaces in my Excel sheet?

If TRIM doesn’t remove the spaces, they might not be regular space characters. Sometimes data imported from other sources can include non-breaking spaces or other characters that TRIM won’t recognize. In this case, you can use the SUBSTITUTE function to replace these specific characters.


  1. Select the cell or range of cells.
  2. Type =TRIM( into the formula bar.
  3. Reference the cell with the text.
  4. Close the function with a parenthesis.
  5. Copy the function to other cells if needed.


Removing spaces in Excel after text is a common task that can make your data cleaner, more accurate, and easier to work with. Whether you’re tidying up a small list or a massive dataset, the TRIM function is your go-to tool for eliminating those unwanted spaces. It’s a simple, yet powerful function that can save you time and frustration. Remember, clean data is the foundation of efficient and reliable data analysis. So, why not give it a try on your next Excel project and see the difference it makes? Happy trimming!

Join Our Free Newsletter

Featured guides and deals

You may opt out at any time. Read our Privacy Policy