FormulaCraft

How to remove non-numeric characters in Excel and Google Sheets

Topic:Text manipulation

Heads up: Excel and Google Sheets do this differently.

Excel
=TEXTJOIN("",TRUE,IF(ISNUMBER(VALUE(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))),MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1),""))
Google Sheets
=REGEXREPLACE(A2,"[^0-9]","")

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1In Google Sheets, enter =REGEXREPLACE(A2,"[^0-9]","") — this replaces every character that is NOT a digit with nothing.
  2. 2In Excel 365, use =TEXTJOIN("",TRUE,IF(ISNUMBER(VALUE(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))),MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1),"")) as a Ctrl+Shift+Enter array formula.
  3. 3Wrap in VALUE() if you need the output as an actual number rather than a text string.
  4. 4Copy the formula down for all rows.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

Will this work on phone numbers with parentheses and dashes?

Yes — all non-digit characters including parentheses, spaces, and dashes are removed, leaving only the numeric digits.

What about preserving a leading plus sign for international numbers?

Adjust the regex to [^0-9+] to allow the plus sign through.

More on Text manipulation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: