Business tasks · Excel formula

Remove extra spaces

Use TRIM to clean repeated spaces from imported text.

Illustrated spreadsheet concept

Use this formula

=TRIM(A2)

The example below uses the column letters and row numbers in the formula. Enter it in a blank cell after the sample data.

See the cells and result

Visual example for Remove extra spaces with sample rows and expected result

Example data

RowOriginal textCleaned text
2 North Office North Office
3Sales TeamSales Team

Expected result: North Office.

Why it works

TRIM removes leading and trailing spaces and reduces repeated ordinary spaces within the text to one.

Check this: TRIM does not remove every nonbreaking space found in web data. SUBSTITUTE can replace character 160 first.

Excel versions and testing

The example uses standard worksheet formulas. Open the workbook in a current desktop Excel version; other editions may display or calculate differently.

This original example has been checked against the browser formula engine and the downloadable workbook structure. The workbook has not been verified in every Excel edition. Microsoft function reference.

Common mistake and fix

If imported text looks unchanged, inspect extra spaces and characters in the source cell; TRIM does not remove every nonbreaking space.

Try it yourself

Change a number or label in the data and predict the new result. Use the practice lab to test a supported formula, or download the data to work in Excel.

Try this example onlineDownload Excel workbookDownload CSV