Data Import & Export

Remove Spaces from Long Numbers in Excel Without Losing Digits

Aamir Naveed AkramAamir Naveed Akram Dec 2, 2026 869 views

Question details

Remove embedded spaces from a long number while preserving every digit.

Remove Spaces from Long Numbers in Excel Without Losing Digits
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user needs to clean a value such as 8350 8380 8384 8385 without converting it to a numeric value.
Observed behavior
The desired result is a continuous string of digits displayed without rounding or scientific notation.
Before you start

Make sure the original value is stored as text before removing spaces. Excel retains only 15 significant digits in numeric values, so digits already rounded during entry or import cannot be recovered from the cell.

Solution 1Recommended

Use SUBSTITUTE to Remove Spaces and Keep the Result as Text

Use this formula when the original long value is stored as text and contains ordinary spaces.

1
Check the source value

Select cell D5 and check the formula bar to confirm that the original value contains all its digits. If it was rounded during import, reimport it from the original source as text.

2
Enter the formula

Select an empty cell, such as E5, enter =SUBSTITUTE(D5," ","") and press Enter. The result is returned as text.

3
Apply it to other rows

Select E5 and drag its fill handle down to remove spaces from additional values in column D.

4
Keep the cleaned values

If you no longer need the formulas, copy the results and use Home > Paste > Values to paste them as text values.

Use SUBSTITUTE to Remove Spaces and Keep the Result as Text
Do not convert the result to a number: Keep the cleaned value as text. Converting a 16-digit value to a number can cause Excel to round digits beyond its 15-digit precision limit.
Clean long numbers in WPS Spreadsheets

Remove Spaces from Long Numbers in WPS Spreadsheets

Use WPS Spreadsheets to store long values as text and remove embedded spaces with the SUBSTITUTE function.

  1. 1. Set the source cells to text: In WPS Spreadsheets, select the destination cells, press Ctrl+1, and choose Text in the cell format options before entering the long values.
  2. 2. Enter the original value: Type or paste the spaced value into cell D5 and check the formula bar to confirm that every digit is present.
  3. 3. Remove the spaces: Select E5, enter =SUBSTITUTE(D5," ","") and press Enter. Keep the result as text rather than converting it to a number.
  4. 4. Save the cleaned values: Drag the fill handle down for additional rows, then use Copy and Paste Special > Values if you need fixed results instead of formulas.
Remove ordinary spaces while keeping the result as textOpen and save Microsoft Excel XLSX filesUse familiar spreadsheet formulas and controlsWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why did Excel change the last digit of my long number?

Excel stores numeric values with only 15 significant digits. Re-enter or reimport the original value as text; formatting an already rounded number as text will not restore the lost digits.

How do I keep a long number from appearing in scientific notation?

Format the destination cell as Text before entering the value, or set the column to Text during import. The SUBSTITUTE formula also returns its result as text.

What if SUBSTITUTE does not remove the spaces?

The characters may be nonbreaking spaces rather than ordinary spaces. Try =SUBSTITUTE(D5,CHAR(160),"") or nest it with the ordinary-space formula to remove both types.

Can I replace the formulas with the cleaned values?

Yes. Copy the formula results, then select Home > Paste > Values. Keep the pasted values as text to preserve all digits.