Function Problems

Remove Spaces from Numbers and Replace Negatives with Zero in Excel

Anum MushtaqAnum Mushtaq Nov 20, 2026 871 views

Question details

Remove spaces from numbers stored as text and convert negative values to zero while preserving positive values.

Remove Spaces from Numbers and Replace Negatives with Zero in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains values such as "1 016" and negative numbers that need to be cleaned for use in formulas.
Observed behavior
Numbers containing spaces may be stored as text and may not work correctly in formulas; negative values need to become zero.
Before you start

Identify the column containing the values and choose an empty neighboring column for the results. Check that decimal separators in the data match your spreadsheet's regional settings.

Solution 1Recommended

Use a Helper Formula to Clean Numbers and Replace Negatives

Use one formula to remove ordinary and nonbreaking spaces, convert the result to a number, and replace negative values with zero.

1
Enter the formula

If the first source value is in A1, select B1 and enter =MAX(0,VALUE(SUBSTITUTE(SUBSTITUTE(A1,CHAR(160),"")," ",""))).

2
Fill down

Drag the fill handle at the lower-right corner of B1 down alongside the values in column A.

3
Replace the originals if needed

Select and copy the results in column B. Select A1, then choose Home > Paste > Paste Special > Values to replace the original data with the cleaned numbers.

Use a Helper Formula to Clean Numbers and Replace Negatives
Check nonnumeric entries: The formula expects a recognizable number after spaces are removed. Blank cells or other text may produce an error and should be checked separately.
Clean Numbers in WPS Spreadsheet

Clean Spaced Numbers and Negative Values in WPS Spreadsheet

Use a helper formula in WPS Spreadsheet to remove spaces, convert text to numbers, and replace negative values with zero.

  1. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet and locate the column containing the values.
  2. 2. Enter the formula: If the first value is in A1, select B1 and enter =MAX(0,VALUE(SUBSTITUTE(SUBSTITUTE(A1,CHAR(160),"")," ",""))).
  3. 3. Fill the remaining rows: Drag the fill handle from B1 down to apply the formula to the other values.
  4. 4. Paste values if needed: Copy the results, select the original cells, and use Paste Special > Values to replace the source data.
Remove ordinary and nonbreaking spaces with a single formula.Replace negative numbers with zero while preserving positive values.Open and save Microsoft Excel formats, including XLSX.Copy cleaned results as values when you no longer need the formulas.
microsoft office alternative - wps office

Frequently Asked Questions

Why does a number such as "1 016" not work in my Excel formula?

Excel may treat the spaced value as text. Use =VALUE(SUBSTITUTE(A1," ","")) in a helper cell to remove ordinary spaces and convert the result to a number.

How do I remove nonbreaking spaces from numbers?

Use SUBSTITUTE(A1,CHAR(160),"") to remove nonbreaking spaces. Nest it inside another SUBSTITUTE function if the data may also contain ordinary spaces.

Can I replace negative numbers without removing spaces?

For cells that already contain numeric values, enter =IF(A1<0,0,A1) in a neighboring cell and fill the formula down.

How do I keep the cleaned numbers without keeping the formulas?

Copy the helper-column results, select the destination cells, and choose Home > Paste > Paste Special > Values in Excel.