Quite often the issue is a non-breaking space - CHAR(160) - especially from Web text sources -that CLEAN can't remove, so I would go a step further than this and try a formula like this which replaces any non-breaking spaces with a standard one

=TRIM(CLEAN(SUBSTITUTE(A1,CHAR(160)," ")))

Ron de Bruin has an excellent post on tips for cleaning data here

You can also remove the CHAR(160) directly without a workaround formula by

  • Edit .... Replace your selected data,
  • in Find What hold ALT and type 0160 using the numeric keypad
  • Leave Replace With as blank and select Replace All
Answer from brettdj on Stack Overflow
🌐
Microsoft Support
support.microsoft.com › en-us › excel › functions › trim-function
TRIM function | Microsoft Support
Example 3: =TRIM(CLEAN(B5)) combines TRIM and CLEAN functions to remove spaces and clean string. Example 4: ​​​​​​​Copy the example data in the following table and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter.
Discussions

Remove spaces before and after the word in Cell
Hi I am looking for a code to remove the spaces before and after the words in cells in column B. Can anyone help me on this Excel file attached in the below link Remoe spaces before and after the word in Cell.xlsx Thanks in advance More on learn.microsoft.com
🌐 learn.microsoft.com
8
366
Using TRIM or SUBSTITUTE to remove leading spaces
If you are copying from a web page then you are likely copying a non breaking space or another character I cannot recall. Use =CODE( LEFT( cell_address , 1)) to determine what the leading character is then do a search replace (ctrl+h) on it to get of it en masse More on reddit.com
🌐 r/excel
14
8
February 12, 2019
Remove blank spaces at front and back. TRIM doesnt work on more than a single space
TRIM trims ALL leading and trailing spaces. Maybe there are different characters in play, html nbsp; for one. This is easy to test in a single cell with a multi space string before and after and then trim it, and do a count of characters with len() More on reddit.com
🌐 r/excel
21
10
December 21, 2018
Trim function not working on trailing space
Note: This feature may not be available in some browsers. Live Online Excel Training for Your Team from MrExcel. Bring MrExcel to your people. Two hours. High-impact. Zero travel. Click here for details. If you would like to post, please check out the MrExcel Message Board FAQ and register here. If you forgot your password, you can reset your password. ... I have a list of Employee numbers (varying from 4-6 digits) and they have a trailing space on all of them. I have tried the Trim ... More on mrexcel.com
🌐 mrexcel.com
5
0
February 1, 2024
People also ask

Why is TRIM not removing spaces in Excel?
TRIM only removes regular spaces (ASCII code 32). Data copied from web pages, PDFs, or Word documents often contains non-breaking spaces (ASCII code 160), which TRIM does not recognize. Use =TRIM(SUBSTITUTE(A1, CHAR(160), " ")) to convert them to regular spaces first, then trim.
🌐
xelplus.com
xelplus.com › home › tutorials › how to remove spaces in excel (trim, substitute, clean & copilot)
How to Remove Spaces in Excel: 5 Methods (TRIM, CLEAN, Power Query)
How do I remove spaces in Excel?
Use the TRIM function: =TRIM(A1). This removes all leading, trailing, and duplicate spaces while keeping single spaces between words. For non-breaking spaces that TRIM misses, use =TRIM(SUBSTITUTE(A1, CHAR(160), " ")).
🌐
xelplus.com
xelplus.com › home › tutorials › how to remove spaces in excel (trim, substitute, clean & copilot)
How to Remove Spaces in Excel: 5 Methods (TRIM, CLEAN, Power Query)
What is the difference between TRIM and CLEAN in Excel?
TRIM removes extra space characters (ASCII 32). CLEAN removes the first 32 non-printable ASCII characters (codes 0 through 31), such as line breaks, carriage returns, and tabs. Use =TRIM(CLEAN(A1)) together when your data contains both extra spaces and non-printable characters.
🌐
xelplus.com
xelplus.com › home › tutorials › how to remove spaces in excel (trim, substitute, clean & copilot)
How to Remove Spaces in Excel: 5 Methods (TRIM, CLEAN, Power Query)
🌐
DataCamp
datacamp.com › tutorial › how-to-remove-spaces-in-excel
How to Remove Spaces in Excel: 5 Good Methods | DataCamp
March 4, 2026 - Combine TRIM() and CLEAN() to remove spaces. Image by Author. You can use the third-party add-in Ablebits Ultimate Suite for Excel. Its Trim Spaces tool cleans up data quickly. With one click, it takes care of everything. This includes leading and trailing spaces, line breaks, extra blanks between words, and non-breaking spaces.
Find elsewhere
🌐
Ablebits
ablebits.com › ablebits blog › excel › excel formulas › excel trim function - quick way to remove extra spaces
Excel TRIM function - quick way to remove extra spaces
March 20, 2023 - Supposing you have a column of names that have some whitespace before and after the text, as well as more than one spaces between the words. So, how do you remove all leading, trailing and excess in-between spaces in all cells at a time? By copying an Excel TRIM formula across the column, and then replacing formulas with their values.
🌐
XelPlus
xelplus.com › home › tutorials › how to remove spaces in excel (trim, substitute, clean & copilot)
How to Remove Spaces in Excel: 5 Methods (TRIM, CLEAN, Power Query)
For non-breaking spaces (ASCII 160) that TRIM misses, wrap it with SUBSTITUTE: =TRIM(SUBSTITUTE(A1, CHAR(160), " ")). These spaces sneak in when you copy data from web pages, PDFs, or Word documents, and they are the most common reason VLOOKUP and XLOOKUP return #N/A. This guide covers five methods to remove spaces in Excel: TRIM, SUBSTITUTE, the TRIM+CLEAN combo, Find & Replace, Power Query, and the new Copilot Clean Data feature.
Published   April 16, 2026
🌐
W3Schools
w3schools.com › excel › excel_trim.php
Excel TRIM Function
The TRIM function is premade in Excel and used to remove irregular text spacing and keep single spaces between words.
🌐
Excel University
excel-university.com › home › blog › how to remove leading spaces in excel
How to Remove Leading Spaces in Excel - Excel University
January 17, 2023 - Then, use the Excel fill handle to drag that formula down through the rest of the table. The range in this example is C2:C6. The Excel TRIM function will automatically eliminate all of the cell’s leading and trailing spaces.
🌐
Atlassian
atlassian.com › data › databases › how to remove leading and trailing spaces in an entire column in excel google docs
Trimming Spaces in Excel & Google Sheets | Atlassian
Today we’ll examine a few simple ... generally efficient) method for removing both leading and trailing space is to use the TRIM() function....
🌐
Reddit
reddit.com › r/excel › using trim or substitute to remove leading spaces
r/excel on Reddit: Using TRIM or SUBSTITUTE to remove leading spaces
February 12, 2019 -

I have a list of around 500 numbers that I've pasted into Excel. The problem is that they all have a leading space in them, so Excel is not treating them like numbers.

I have tried using the TRIM and SUBSTITUTE formulas to remove the spaces, then copying that and pasting the VALUE into another cell, but it still has a leading space in it. I cannot figure out how to remove the space without manually deleting it, which there are too many numbers to do that to all of them.

🌐
Ablebits
ablebits.com › docs › excel-trim-spaces
How to use Trim Spaces tool for Excel
Select the range where you want ... quickly, click the Expand selection icon. If you pick Trim leading/trailing spaces, the spaces before and after cell values will be deleted....
🌐
Ablebits
ablebits.com › excel-suite › trim-spaces.php
Trim spaces in Excel cells - leading, trailing, non-breaking
Use the Trim Spaces tool to remove leading and trailing spaces or get rid of excess blanks between words.
🌐
Corporate Finance Institute
corporatefinanceinstitute.com › home › resources › trim function
TRIM Function - Formula, Examples, How to Use TRIM in Excel
May 11, 2026 - The TRIM function in Excel removes extra spaces from text, leaving only single spaces between words. It cleans up data by eliminating leading, trailing, and intervening spaces, useful for data imported from other sources.
🌐
Earn and Excel
earnandexcel.com › home › blog › how to remove extra spaces in excel – excel trim function
How to Remove Extra Spaces in Excel – Excel TRIM Function - Earn and Excel
June 12, 2024 - You can use this feature to remove excessive leading, trailing, and spaces in-between values. To find the trimmed values you will need a blank column. Considering the following example, this has a combo of leading, trailing, and spaces in-between.
🌐
Eurocell
eurocell.co.uk
Eurocell: Your Premier Supplier of Windows, Doors, Roofline, Skirting Boards, Finishing Trims & Conservatories
Designed for simple self-build installation, this contemporary anthracite grey garden room combines insulated SIP panel construction, double glazing and low-maintenance finishes for comfortable year-round use. Ideal as a home office, gym, studio or relaxing retreat, it’s a cost-effective way to add versatile living space to your garden without compromising on style
🌐
Excel Unlocked
excelunlocked.com › home › functions › trim function in excel – remove extra spaces
TRIM Function in Excel - Remove Extra Spaces - Excel Unlocked
June 18, 2021 - TRIM function in excel is used to remove all extra spaces between words in a cell in excel. This function belongs to text function group.