Skip to content

Keep only the digits

Strip letters, spaces and symbols so only the numbers remain, for example from phone numbers.

The formula

Argument separator
Excel · Excel 365 only (REGEX functions)
=REGEXREPLACE(A2, "[^0-9]", "")
Google Sheets
=REGEXREPLACE(A2, "[^0-9]", "")

How it works

  1. "[^0-9]"

    Matches any character that is not a digit.

  2. ""

    Replaces each match with nothing, deleting it.

Example

A: RawB: Result
(555) 123-45675551234567
Order #A-00420042

Tips

  • The result is text. Wrap it in VALUE(…) if you need a number (this drops leading zeros).