Remove Spaces in Excel Rows: Trim, Find, and Replace

Formulas & functions · Updated November 18, 2026

To clean spaces at the start or end of text, or reduce repeated spaces between words, use Excel’s TRIM function in a helper column. To delete every ordinary space, use Find and Replace or SUBSTITUTE instead. First save a copy of your workbook, then choose the method that matches the kind of spaces you want to remove.

What You’ll Need

  • An Excel workbook with the text or data you want to clean. These steps are for Microsoft Excel for Microsoft 365 on Windows.
  • A spare column if you plan to use a formula. Keeping the original data lets you check the results before replacing anything.
  • For a large or important dataset, a saved backup copy. Find and Replace changes cells directly and may be difficult to reverse after further edits.

Step-by-Step

  1. Identify what “remove spaces” means for your data. A cell might have unwanted spaces before or after its text, several spaces between words, or spaces that you want to delete entirely. For example, North Ridge has extra spaces around and within the words. TRIM changes it to North Ridge; it does not join the words. If you want NorthRidge, use a method that removes every space. Decide which result you need before applying a change to a whole row or column.
  2. Check the cells you plan to clean. Select a few representative cells and look at the formula bar as well as the visible text. A cell can look as if it contains a regular space but actually contain a nonbreaking space or another invisible character. Also check whether the range contains formulas, numbers, IDs with leading zeros, or dates. These details affect which method is safest and how you should preserve the results.
  3. Use TRIM to remove extra spaces while keeping word breaks. With the original text in A2:A20 and an empty helper column beginning at B2, enter =TRIM(A2) in B2. This removes leading and trailing ordinary spaces and reduces consecutive ordinary spaces between words to one. For example, if A2 contains two spaces before “Blue,” three between “Blue” and “Lake,” and a trailing space, the result is Blue Lake. TRIM does not remove the single space between words.
  4. Fill the formula down the rows. Select B2, then drag the small square at the lower-right corner of the selection (the fill handle) down to the last row of your data. You can also copy B2, select the remaining destination cells, and press Ctrl+V on Windows. Check the top, middle, and bottom results, especially if the source column has blank cells or mixed content. On Mac, use Command+C and Command+V for copying and pasting.
  5. Use SUBSTITUTE when you want to delete every regular space. With the original text in A2:A20 and an empty helper column beginning at B2, enter =SUBSTITUTE(A2," ","") in B2. Fill it down as in the previous step. If A2 contains Blue Lake 7, the result is BlueLake7. This also joins words, so avoid it for names, addresses, or sentences where spaces separate meaningful words.
  6. Use Find and Replace for a quick, direct change. If the selected cells contain plain text and you want to remove every ordinary space, select only the intended range. Press Ctrl+H on Windows to open Replace. In Find what, press the spacebar once; leave Replace with empty. Choose Replace All, review the confirmation, and inspect several cells. Selecting the range first helps limit the change, but be careful if the selection includes formulas: replacing spaces in formulas can alter formula text. On Mac, use Edit > Find > Replace, select the intended range first, and review the results before continuing.
  7. Account for nonbreaking spaces if TRIM does not work. Text copied from websites or documents can contain nonbreaking spaces, which look like ordinary spaces but are not removed by TRIM. With the original text in A2:A20 and an empty helper column beginning at B2, enter =TRIM(SUBSTITUTE(A2,CHAR(160)," ")) in B2 and fill down. This replaces nonbreaking spaces with ordinary spaces, then trims and reduces repeated spaces. If you need to delete those characters rather than turn them into word breaks, use =SUBSTITUTE(A2,CHAR(160),"") instead. Check the output carefully before choosing that version.
  8. Replace the originals only after checking the output. If the cleaned results are correct, select the helper cells and copy them. Select the original destination range, then use Home > Paste > Paste Values. This replaces formulas with their current results instead of leaving references to the helper column. Keep the original column or a backup until you have confirmed the cleaned data still works in sorting, lookups, and other calculations. If formatting matters, check it after pasting; values and formatting are separate.
  9. Remove the helper column when you no longer need it. After confirming the original cells contain the correct results, delete the helper column if it is no longer useful. If you want to keep an audit trail, leave it in place and give it a clear heading such as “Cleaned text.” Save the workbook when the cleanup is complete.

Common Mistakes

Assuming TRIM deletes every space. TRIM is designed to remove extra ordinary spaces while retaining one space between words. If you use it on AB 123, the result is AB 123, not AB123. Use SUBSTITUTE or Find and Replace when joining the text is genuinely intended.

Removing spaces from words that need them. Deleting every space may make names, addresses, product descriptions, or notes unreadable. Test the approach on a few cells first. For a postal code or identifier, confirm the required format before changing it.

Overwriting the source before checking. A helper column makes it easy to compare each original value with its cleaned version. Do not paste over the original data until you have reviewed examples from the full range and are satisfied with the output.

Applying Find and Replace too broadly. If you do not select a range first, Replace All can affect more of the active worksheet than you intended. A selection is a useful safeguard, but do not treat it as permission to replace spaces in formulas without checking. Work on a copy when the workbook contains important calculations.

Ignoring invisible characters or data types. A nonbreaking space may survive an ordinary TRIM formula. Meanwhile, a formula result can behave differently from a source value that is a number, date, or text identifier. Check the actual cell contents and the displayed format, not just what appears at a glance.

Tips

Keep a clear distinction between cleaning excess whitespace and deleting all whitespace. TRIM is usually the better first choice for human-readable text because it preserves a single separator between words. SUBSTITUTE is more suitable for codes or fields where spaces are never valid. If you are unsure, create two helper columns with different methods and compare the results before deciding.

For repeatable cleanup, store the formula in a helper column and use Excel’s fill handle rather than editing each row individually. If a filtered table is involved, make sure you understand which rows are selected before pasting results; a normal fill or paste can affect a broader range than the visible records. Consider converting the cleaned results to values once approved so they do not depend on a temporary source column.

Do not use a formula cleanup to solve a different problem, such as deleting blank rows or shifting cells left. Spaces are characters inside cell content; blank cells and empty rows are structural issues. Removing spaces from a cell will not move adjacent cells or remove an entire row.

Troubleshooting

The result looks unchanged after TRIM. The cell may contain a nonbreaking space or a different invisible character. Try the CHAR(160) formula in the steps above. If it still does not clean the text, inspect the source by testing a small sample and consider whether the character is a tab, line break, or another Unicode space rather than an ordinary space. CLEAN can remove some nonprinting ASCII characters, but it does not remove every special Unicode character.

The formula appears in the cell instead of its result. Check that the destination cell is not formatted as Text. Change it to General using Home > Number Format > General, then re-enter the formula. Also confirm that the entry begins with an equals sign and that Show Formulas is not turned on. On Windows, Ctrl+` toggles formula display; the backtick key is usually below Esc. On Mac, the shortcut can vary by keyboard and Excel settings, so check the Formulas tab or Excel preferences if formulas are being displayed.

Excel displays an error after you enter a formula. Check that the formula has balanced parentheses and straight quotation marks, and that the cell reference points to the source text. The formulas shown here use commas as argument separators. Some regional settings use semicolons instead; if Excel rejects a correctly copied formula, use the argument separator required by your installation.

Find and Replace changes something unexpected. Immediately press Ctrl+Z on Windows, or Command+Z on Mac, if the change is still the most recent action. If further edits have been made, restore the backup copy rather than assuming Undo will safely reverse only the replacement. Reopen Replace with a smaller selected range and check the Find what box for exactly one space before trying again.

The cleaned text still has odd gaps or the row looks wrong. Check for multiple kinds of whitespace and for cells that contain formulas or formatting that affects how values appear. Compare the formula bar text with the displayed value. If the problem is actually empty cells, merged cells, or row height, removing spaces will not fix it; address that separate layout or data issue.

Frequently Asked Questions

Does TRIM remove spaces between words?

It reduces multiple consecutive ordinary spaces between words to one. It also removes ordinary spaces at the beginning and end of text. It does not delete the remaining word separator, and it does not reliably remove nonbreaking spaces unless you replace those first.

How do I remove all spaces from a row without a formula?

Select only the text cells you want to change, open Replace with Ctrl+H on Windows or Edit > Find > Replace on Mac, enter one space in Find what, leave Replace with empty, and choose Replace All. Check that the range does not include formulas or unrelated text before applying it.

Can I clean an entire row at once?

Yes. You can apply a helper formula to each cell or use Find and Replace on a selected row or range. Decide whether you want to trim excess spaces or delete every space, and select only the cells that should change. A formula in one helper cell cleans only the referenced cell; fill or copy it across as well as down if your data spans multiple columns.

Will removing spaces change numbers or dates?

It can change text that looks like a number or date, and a formula result may not retain the source cell’s number format. Check identifiers with leading zeros especially carefully, since Excel may treat them as text or numbers depending on how they were entered. Review both the result and its formatting before replacing the originals.

Why does TRIM leave a space that I cannot see?

The character may be a nonbreaking space, often found in copied web text, rather than a regular space. Replace CHAR(160) with an ordinary space before applying TRIM, or remove CHAR(160) if the character should be deleted entirely. Other special whitespace characters may need separate identification and cleanup.

Does removing spaces delete empty rows?

No. These methods edit characters inside cell values. They do not delete blank rows, shift cells, or remove empty cells. Use a separate row-cleanup method if your goal is to remove records that are entirely blank.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.