How to remove non-numeric characters in Google Sheets
Google Sheets formula
=REGEXREPLACE(A2,"\D","")Replace every non-digit with nothing: =REGEXREPLACE(A2,"\D","").
- Result on the example
- one result per row in
B2, filled down toB6 - Excel
- See below
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
How it works
\D means any character that isn't a digit 0 to 9. REGEXREPLACE replaces every match, not just the first, so brackets, dots, dashes, spaces, slashes and letters all disappear in one step. The result stays text, which keeps leading zeros.
=REGEXREPLACE(A2,"\D","")Result"16125550148"
A2"+1 (612) 555-0148"The value in A2.
REGEXREPLACE(A2,"\D","")"16125550148"REGEXREPLACE: Replaces every match. Use $1 for a captured group.- text
A2"+1 (612) 555-0148" - regular_expression
"\D" - replacement
""
- text
In Excel
=CONCAT(IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,"")).Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =CONCAT(IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,""))Excel only | 16125550148, 6125550193, 17635550107… | For Excel 2021 and later without regular expressions: every character that can't be multiplied by 1 is dropped. |
| =VALUE(REGEXREPLACE(A2,"\D","")) | 16125550148, 6125550193, 17635550107…Different result | Convert to a number when the digits are an amount, not a code. Numbers, which drop leading zeros and can show in scientific notation. |
Common mistakes
- Decimal points are removed too: "$1,249.50" becomes 124950. Keep the dot with
"[^\d.]". - Turning long codes into numbers loses leading zeros and precision past 15 digits. Keep IDs and phone numbers as text.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Remove non-numeric characters
B2, remove every character that isn't a digit from the phone number in A2, keeping the result as text. Fill down to B6.Questions
How do I keep only the last 10 digits?
Take the right 10 characters: =RIGHT(REGEXREPLACE(A2,"\D",""),10).
How do I remove letters only?
Use "[A-Za-z]" as the pattern.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine.