Cleaning numbers in Excel means converting text-formatted numbers, numbers stored as text, or inconsistent numeric entries into true values Excel can use in calculations, sorting, and filtering. This is necessary because Excel treats numbers stored as text differently—even if they look identical, operations like SUM or AVERAGE may ignore them, and sorting places them alphabetically instead of numerically. You’ll need a working copy of Excel (desktop version for full feature access) and a file containing the problematic data.

What You’ll Need

  • Microsoft Excel (desktop version: Windows or Mac); Excel Online has limited cleaning tools
  • A backup of your workbook (File > Save As > Create a Copy) before applying bulk changes
  • Identified column or range with dirty numbers (e.g., values with leading/trailing spaces, apostrophes, non-breaking spaces, or inconsistent decimal separators)

Step-by-Step

  1. Identify the issue: Select the column or range with suspect numbers. Press F5 (Windows) or Command+G (Mac) to open the Go To dialog, then click Special…. Check Constants, leave Numbers unchecked, and check Text, Logicals, and Errors. Click OK. Excel highlights cells containing non-numeric constants—these are likely your problem cells. If none highlight, try selecting a cell and look for a small green triangle in the top-left corner (Excel’s error indicator for numbers stored as text).
  2. Remove leading/trailing spaces: Use the TRIM function to eliminate accidental spaces. In a new column (e.g., if your data is in A2:A100, use B2), enter =TRIM(A2). Copy this down the column. Then copy the entire helper column, right-click the original column, and choose Paste Special > Values to overwrite with cleaned text. Finally, delete the helper column.
  3. Convert text to numbers using VALUE: If cells still show as text after trimming, wrap TRIM in VALUE. In B2, enter =VALUE(TRIM(A2)). Copy down. Then paste values over the original column as before. VALUE converts text strings like "123.45" into real numbers—only works if the text is a valid numeric format for your locale.
  4. Use Paste Special > Multiply by 1: Select the problematic range (e.g., A2:A100). Copy an empty cell (e.g., C1 containing just 0 or left blank). Select your range again, right-click, choose Paste Special…, select Multiply, and click OK. This forces Excel to re-evaluate each cell’s content, converting text numbers to true values. Delete the helper cell afterward.
  5. Apply the Text to Columns wizard: Select your column. Go to Data > Text to Columns. In Step 1, choose Delimited or Fixed width (if numbers have no delimiters, use Fixed width and click once above the column to create a break line). Click Next. In Step 2, leave all delimiters unchecked unless your data has commas or tabs. In Step 3, under Column data format, select General or Number (avoid Text). Click Finish. This often strips hidden characters and re-formats to true numbers.
  6. Fix locale-specific issues (commas vs. decimals): If your system uses commas as decimal separators (e.g., "123,45"), but Excel expects periods, use SUBSTITUTE. In B2, enter =VALUE(SUBSTITUTE(A2,",",".")) for European-style numbers. Adjust based on your locale needs. Then paste values over the original range.
  7. Remove apostrophes: An apostrophe before a number (e.g., '123) forces Excel to treat it as text. Select the range, press Ctrl+H (Windows) or Command+Shift+H (Mac) to open Find and Replace. In Find what, type an apostrophe ('). Leave Replace with blank. Click Replace All. Confirm replacements and re-check the column—apostrophes should be gone, and numbers may now display correctly.

Common Mistakes

  • Using TRIM alone without VALUE—it removes spaces but leaves values as text, which still won’t calculate correctly.
  • Skipping the backup step, then overwriting data incorrectly and losing original values.
  • Assuming all numbers are "stored as text" when non-breaking spaces (inserted via Alt+0160 on Windows) mimic regular spaces and require TRIM + CLEAN or manual removal.
  • Using Find and Replace to remove apostrophes without verifying—some cells may have apostrophes as part of legitimate text (e.g., "123'456" as a measurement), so test on a small range first.
  • Applying Paste Special > Multiply without copying an empty cell first—this can cause errors if the helper cell isn’t truly blank or contains spaces.

Tips

  • Check cell alignment: true numbers align right by default; text aligns left. Use Home > Number group to apply a number format (e.g., Number or General)—if alignment doesn’t change, the cell is still text.
  • Use conditional formatting to highlight non-numeric cells: select the range, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter =NOT(ISNUMBER(A2)) (adjust A2 for your top cell), set a fill color, and click OK.
  • For large datasets, combine methods: use =VALUE(TRIM(CLEAN(A2))) to handle line breaks, non-printing characters, and spaces in one go, then paste values.
  • After cleaning, run Formulas > Error Checking to catch lingering issues like #VALUE! errors from invalid conversions.
  • Prevent future issues: when importing CSVs or pasting from web sources, use Data > From Text/CSV (Power Query) to set column data types during import.

Troubleshooting

If your numbers still won’t calculate or sort correctly:

  1. Restart Excel and re-check: sometimes calculation mode is set to Manual (Formulas > Calculation Options). Switch to Automatic.
  2. Verify locale settings: Go to File > Options > Advanced > scroll to When calculating this workbook. Check Use system separators and confirm decimal/thousand separators match your data.
  3. Check for hidden characters: In a helper column, use =CODE(RIGHT(A2,1)) to see the ASCII code of the last character. Codes 160 indicate non-breaking spaces; use =SUBSTITUTE(A2,CHAR(160)," ") to replace them before TRIM.
  4. Re-import data cleanly: If data came from a database or web query, re-run the query with explicit data type casting (e.g., cast to DECIMAL in SQL first).
  5. Try Power Query: Select your data > Data > Get & Transform Data > From Table/Range. In Power Query Editor, right-click the column header > Change Type > Using Locale…, pick a locale (e.g., English (United States)), and set data type to Number. Click OK, then Close & Load to return cleaned data to Excel.

Frequently Asked Questions

Why does Excel show a green triangle on some numbers?

It indicates Excel suspects the number is stored as text. Hover over it to see the error message. This often happens after pasting from other programs or importing CSVs. Cleaning with VALUE or Paste Special > Multiply resolves it.

Can I clean numbers in Excel Online?

Yes, but with limitations. You can use TRIM, VALUE, and Find and Replace. However, Paste Special and Power Query are not available in Excel Online—use them only in the desktop app for full control.

My numbers still sort alphabetically after cleaning—what’s wrong?

Excel may still be reading them as text. Check a cell’s actual value: click it, look in the formula bar, and ensure no apostrophe appears before the number. Re-run cleaning steps, especially checking for non-breaking spaces with =CODE(LEFT(A2,1)).

Is there a keyboard shortcut to convert text to numbers?

No single shortcut, but the fastest workflow is: select the range, press Alt+E+S+M (Windows, for Paste Special > Multiply) after copying an empty cell. On Mac, use Command+C on a blank cell, select range, then Command+Option+V > Multiply.

What if some cells contain mixed text and numbers (e.g., "Item: 123")?

Extract the number first using functions like RIGHT, LEFT, or MID combined with FIND, or use Power Query’s Extract > Text Between Delimiters. There’s no universal clean function—cleaning depends on the exact pattern.

Will cleaning affect formulas referencing these cells?

Yes—if formulas rely on text comparisons (e.g., =A2="123"), they may break after conversion. Always review dependent formulas after cleaning. Use =VALUE(A2) in formulas instead of direct references to avoid mismatches.