Table of Contents
Quickly remove spaces with the "Find and Replace" function
Use TRIM function to clean up spaces before and after
Batch processing of large amounts of data with Power Query
Note: Some spaces are not "normal spaces"
Home Software Tutorial Office Software How to remove spaces in Excel

How to remove spaces in Excel

Jul 28, 2025 am 03:56 AM

1. Use the "Find and Replace" function to quickly remove spaces, press Ctrl H in the selected area, enter spaces in "Find Content", "Replace with" and leave blank, and click Replace all; 2. Use the TRIM function to clean up the spaces before and after, and enter the formula =TRIM(A1) to retain the normal spaces in the middle; 3. Use Power Query to batch process a large amount of data, and after import, select the column and select "Trim" in the "Conversion" tab and then import it back to Excel; 4. For special spaces, you can use CHAR(160) to find replacement or combine with the CLEAN function to process, such as =TRIM(CLEAN(A1)), which is suitable for data copied from web pages. These methods are suitable for different scenarios and can efficiently remove unnecessary spaces.

How to remove spaces in Excel

Sometimes there are more spaces in Excel tables, which look particularly annoying, especially data copied from elsewhere, which is particularly common. If you want to quickly remove these extra spaces, you don’t need to delete them manually one by one. There are several simple and practical methods in Excel that can directly solve this problem.

How to remove spaces in Excel

Quickly remove spaces with the "Find and Replace" function

This is the most direct way to remove all spaces or spaces at specific locations. For example, if you want to remove all the spaces in a whole column, you can use this method.
Operation steps:

  • Select the data area to be processed
  • Press Ctrl H to open the "Find and Replace" window
  • Enter a space in "Find Content" (press the space bar directly)
  • Leave empty in "Replace with"
  • Click "Replace All"

This method is suitable for sorting before processing data, especially when there are extra front and back spaces or extra middle spaces in the data, the effect is very obvious.

How to remove spaces in Excel

Use TRIM function to clean up spaces before and after

If you just want to clear out the spaces before and after the cell content, instead of the separating spaces in the middle, the TRIM function is suitable.
For example, the content of cell A1 is "Hello World", with spaces in front and behind. The result is "Hello World" after using the formula =TRIM(A1) .
This function will not remove normal spaces in the middle, but only handles extra spaces at the beginning and end, which is suitable for processing text-like data, such as name, address, product name, etc.

Batch processing of large amounts of data with Power Query

If you often process large batches of data imported from the outside, you may find manual operations too cumbersome. At this time, you can use Power Query to batch remove spaces.
The steps are roughly as follows:

How to remove spaces in Excel
  • Import data into Power Query Editor
  • Select the column to be processed
  • In the Convert tab, select the drop-down menu next to "Format" -> "Lowercase" and select "Trim"
  • Finally, click "Close and Upload" to import the processed data back to Excel

This method is suitable for processing thousands of pieces of data, and can save query steps. The next time you refresh it directly, you can automatically process new data.

Note: Some spaces are not "normal spaces"

Sometimes you will find that even though the above method is used, the spaces can't be removed. This may be because those "spaces" are not actually ordinary space characters, but uninterrupted spaces, tabs, or other invisible characters.
At this time, you can try the following method:

  • Enter CHAR(160) (uninterrupted space) in the search content and replace it with empty
  • Or use the CLEAN function to match TRIM, such as =TRIM(CLEAN(A1))

This kind of problem is more common when copying data from web pages, and you can avoid getting stuck by a little attention.

Basically, these methods are used in different ways to deal with them in different situations. It is not complicated but easy to ignore that some spaces are not as simple as they seem, and you need to pay more attention to the data source and space types.

The above is the detailed content of How to remove spaces in Excel. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Why does Microsoft Teams use so much memory? Why does Microsoft Teams use so much memory? Jul 02, 2025 pm 02:10 PM

MicrosoftTeamsusesalotofmemoryprimarilybecauseitisbuiltonElectron,whichrunsmultipleChromium-basedprocessesfordifferentfeatureslikechat,videocalls,andbackgroundsyncing.1.Eachfunctionoperateslikeaseparatebrowsertab,increasingRAMusage.2.Videocallswithef

5 New Microsoft Excel Features to Try in July 2025 5 New Microsoft Excel Features to Try in July 2025 Jul 02, 2025 am 03:02 AM

Quick Links Let Copilot Determine Which Table to Manipu

What is the meeting time limit for the free version of Teams? What is the meeting time limit for the free version of Teams? Jul 04, 2025 am 01:11 AM

MicrosoftTeams’freeversionlimitsmeetingsto60minutes.1.Thisappliestomeetingswithexternalparticipantsorwithinanorganization.2.Thelimitdoesnotaffectinternalmeetingswhereallusersareunderthesameorganization.3.Workaroundsincludeendingandrestartingthemeetin

how to group by month in excel pivot table how to group by month in excel pivot table Jul 11, 2025 am 01:01 AM

Grouping by month in Excel Pivot Table requires you to make sure that the date is formatted correctly, then insert the Pivot Table and add the date field, and finally right-click the group to select "Month" aggregation. If you encounter problems, check whether it is a standard date format and the data range are reasonable, and adjust the number format to correctly display the month.

How to use Microsoft Teams? How to use Microsoft Teams? Jul 02, 2025 pm 02:17 PM

Microsoft Teams is not complicated to use, you can get started by mastering the basic operations. To create a team, you can click the "Team" tab → "Join or Create Team" → "Create Team", fill in the information and invite members; when you receive an invitation, click the link to join. To create a new team, you can choose to be public or private. To exit the team, you can right-click to select "Leave Team". Daily communication can be initiated on the "Chat" tab, click the phone icon to make voice or video calls, and the meeting can be initiated through the "Conference" button on the chat interface. The channel is used for classified discussions, supports file upload, multi-person collaboration and version control. It is recommended to place important information in the channel file tab for reference.

How to Fix AutoSave in Microsoft 365 How to Fix AutoSave in Microsoft 365 Jul 07, 2025 pm 12:31 PM

Quick Links Check the File's AutoSave Status

How to change Outlook to dark theme (mode) and turn it off How to change Outlook to dark theme (mode) and turn it off Jul 12, 2025 am 09:30 AM

The tutorial shows how to toggle light and dark mode in different Outlook applications, and how to keep a white reading pane in black theme. If you frequently work with your email late at night, Outlook dark mode can reduce eye strain and

how to repeat header rows on every page when printing excel how to repeat header rows on every page when printing excel Jul 09, 2025 am 02:24 AM

To set up the repeating headers per page when Excel prints, use the "Top Title Row" feature. Specific steps: 1. Open the Excel file and click the "Page Layout" tab; 2. Click the "Print Title" button; 3. Select "Top Title Line" in the pop-up window and select the line to be repeated (such as line 1); 4. Click "OK" to complete the settings. Notes include: only visible effects when printing preview or actual printing, avoid selecting too many title lines to affect the display of the text, different worksheets need to be set separately, ExcelOnline does not support this function, requires local version, Mac version operation is similar, but the interface is slightly different.

See all articles