In short
- In a spare column type =TRIM(A2) and copy it down. TRIM removes spaces at the start and end of the text and shrinks any run of spaces inside to one. Then copy the results and paste them back as values.
- If the spaces stay, they are probably non-breaking spaces from a web page or an export. Use =TRIM(SUBSTITUTE(A2,CHAR(160)," ")) instead. To remove every space, use Find and Replace.
- Fix a few cells by hand on EditFlip
You import a list, and a lookup that should work returns an error. A sort puts “Smith” in the wrong place. Two names that look the same are counted as different. Most of the time the reason is invisible: an extra space before, after or inside the text.
This guide explains how to find those spaces, how to remove them with TRIM or with Find and Replace, what to do about the stubborn kind that TRIM cannot see, and how to put the cleaned values back so the formulas can go. It also says where EditFlip fits: it is good for fixing a few cells by hand, and it does not have Find and Replace.
On EditFlip, step by step
- Step 1
Open the workbook
Go to editflip.com, press Choose files and pick the Excel or CSV file. In the Options panel press Edit. The sheets show as tabs at the bottom, so open the one that has the messy column.
- Step 2
Find the cells with extra spaces
Look down the column for values that sit slightly off the left edge, or names that seem to repeat. Tap a cell to see what is inside it. A space at the end is easy to miss, so tap into the text and move to its end to check.
- Step 3
Correct them by hand
Tap the cell, delete the extra spaces and type the value cleanly. This is practical for a handful of cells. For hundreds, EditFlip is the wrong tool, because it has no Find and Replace. Use TRIM or Replace in Excel for those.
- Step 4
Done, then Download
Press Done to make the corrected file, named with “(edited)” after the original name, and press Download. Formulas already in the file keep working, so a lookup that failed because of a space can now find its match.
Why an extra space breaks things
To Excel, “Smith” and “Smith ” (with a space at the end) are two different words. A VLOOKUP or XLOOKUP that searches for one will not find the other and will return #N/A. A COUNTIF will count them separately. A pivot table will list them as two lines. A sort may put the one with a leading space at the top, above all the others.
The spaces come from the ways data gets into Excel. People type a space out of habit. A copy from a web page or a PDF brings spaces along. Exports from accounting or booking programs often pad each value to a fixed length. A column joined from two others can end up with a double space where one part was empty.
The damage is quiet. Nothing looks wrong on the screen. You only learn about it when a total does not match or a lookup fails, so it pays to clean imported data before you use it.
How to see which cells have the problem
Compare the length of the text with and without spaces. In a spare column next to your data, type =LEN(A2) and, in the next column, =LEN(TRIM(A2)). If the two numbers differ, the cell has extra spaces. A single formula does the check: =LEN(A2)<>LEN(TRIM(A2)) gives TRUE for each cell that needs cleaning.
To find them at a glance, use Filter on the check column and show only TRUE. This is also a good way to count how many cells are affected before you start.
A cell can look empty and still hold a space. The check shows it as a length of 1. Such cells matter because Excel does not treat them as blank, so functions that skip blanks do not skip them.
Remove spaces with TRIM
TRIM does three things. It removes spaces before the first character, it removes spaces after the last one, and it turns any run of spaces between words into a single space. In a spare column next to your data, type =TRIM(A2) and copy it down to the last row. The new column holds the cleaned text.
The cleaned values are formulas. To keep them, select the new column, copy it, right-click the first cell of the old column and use Paste Special, then Values. The old text is replaced by the clean text. Now you can delete the helper column. If you skip this step and delete the original column first, the formulas break.
TRIM is for text. It cannot make a missing space appear, and it leaves a single space between words alone, which is what you want. If your values are numbers stored as text, with spaces around them, =VALUE(TRIM(A2)) cleans the spaces and turns the result into a real number.
Remove spaces with Find and Replace
Find and Replace is faster when you want to change cells in place, with no helper column. Select the column, press Ctrl+H, type two spaces in the Find box and one space in the Replace box, and press Replace All. Press it again until Excel says it made no replacements, because a run of four spaces becomes two, then one.
This method does not touch spaces at the very start or end of a value in a clever way: it only shrinks double spaces. For leading and trailing spaces, TRIM is the better tool.
When you want every space gone, for example from a phone number or a product code, put one space in the Find box and leave the Replace box empty. Select the column first, because otherwise the replacement runs on the whole sheet and removes the spaces between words in cells you did not mean to change.
The space TRIM cannot see
If you used TRIM and the lookup still fails, the culprit is usually a non-breaking space. It looks exactly like a normal space, but its character code is 160, not 32, and TRIM only removes code 32. These spaces arrive from web pages, from Word, and from some exports.
The fix is to swap them for a normal space first: =TRIM(SUBSTITUTE(A2,CHAR(160)," ")). SUBSTITUTE replaces every code 160 with a plain space, and TRIM then does its usual work. Copy it down, then paste as values.
With Find and Replace, click in the Find box, hold Alt and type 0160 on the numeric keypad, and leave the Replace box empty or put a normal space in it. On a laptop without a keypad, copy one of the spaces out of a cell and paste it into the Find box.
Text can also hold characters that do not print at all, such as line breaks. The CLEAN function removes those. You can nest all three: =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))). It is a safe default for imported data.
Making sure the data works again
After cleaning, test the thing that was failing. Run the lookup again, re-sort the column, or refresh the pivot table, which needs a manual refresh after the source changes. Entries that were split in two should now be merged.
Keep a copy of the original column until you are sure. Paste as values cannot be undone once you have saved and closed the file. A spare sheet with the raw data costs nothing and saves a lot of worry.
To stop the problem coming back, clean data at the door. When a new export arrives, paste it into a raw sheet and let a clean sheet take its values through TRIM. You then never edit the raw data, and the clean sheet updates on its own.
On a phone
The formulas above work in Excel on a computer or in the Excel app. On a phone without Excel, EditFlip opens the workbook in your browser and lets you edit cells by tapping them, so a few bad values can be fixed on the spot. The file stays on your device and is not uploaded. For a big clean-up, plan to do it on a computer.
A habit that helps on any device: before you send a list to someone, tap into a few cells at the bottom and the top and check that nothing hangs after the last letter. Those two ends are where stray spaces hide most often.
Open the workbook, tap the cells with extra spaces and correct them, then download the result. For whole columns, use TRIM or Find and Replace in Excel. Free, no account, and the file stays on your device.
Fix cells in an Excel file on EditFlip →Questions
How do I remove extra spaces in Excel?
Type =TRIM(A2) in a spare column and copy it down. TRIM removes spaces at the start and end and reduces runs of spaces to one. Paste the results back as values.
Why does TRIM not remove all the spaces?
Probably because they are non-breaking spaces, code 160. Use =TRIM(SUBSTITUTE(A2,CHAR(160)," ")) to turn them into normal spaces first.
How do I remove every space from a cell, not just the extra ones?
Select the cells, press Ctrl+H, put one space in Find and leave Replace empty, then press Replace All. Or use =SUBSTITUTE(A2," ","").
How do I check which cells have extra spaces?
Use =LEN(A2)<>LEN(TRIM(A2)). It gives TRUE for each cell with extra spaces. Filter on TRUE to see them all.
Why does my VLOOKUP return #N/A when the values look the same?
A hidden space at the end of one value is a common cause. Clean both lists with TRIM, and try again.
Can I remove spaces without using a formula?
Yes. Use Find and Replace with Ctrl+H. Two spaces to one space, repeated until nothing changes, handles doubled spaces. It does not clean spaces at the start or end.
Can EditFlip remove the spaces?
For a few cells, yes: open the file, tap a cell and correct it. It has no Find and Replace, so for a whole column use Excel.
