Keep only the digits
Strip letters, spaces and symbols so only the numbers remain, for example from phone numbers.
The formula
Excel · Excel 365 only (REGEX functions)
=REGEXREPLACE(A2, "[^0-9]", "")Google Sheets
=REGEXREPLACE(A2, "[^0-9]", "")How it works
"[^0-9]"Matches any character that is not a digit.
""Replaces each match with nothing, deleting it.
Example
| A: Raw | B: Result |
|---|---|
| (555) 123-4567 | 5551234567 |
| Order #A-0042 | 0042 |
Tips
- The result is text. Wrap it in VALUE(…) if you need a number (this drops leading zeros).