Remove non numeric characters and spaces in google sheet cell

Viewed 9819

I am trying to remove non-numeric character in a cell. Can someone help what should be the right formula?
Assuming A1 has a value of (453) 567-1234.
What should be the formula for the cell to have only 4535671234?

2 Answers

There are many regex patterns to return just digits.

The following is one of them

Returned as number:

=REGEXREPLACE($A$1,"\D+", "")+0

Returned as text/string:

=REGEXREPLACE($A$1,"\D+", "")

REGEX to return just digits

Functions used / more info:

If you want to have only the digits, you can have the following:

  • result as a string: =REGEXREPLACE(A1,"[^\d]", "")
  • result as a number: =VALUE(REGEXREPLACE(A1,"[^\d]", ""))

enter image description here

For more references of the regex language google sheets uses, you have the documentation here.

Related