Home » Google Sheets: How to Extract Numbers from String

Google Sheets: How to Extract Numbers from String

by Erma Khan

You can use the following formula to extract numbers from a string in Google Sheets:

=REGEXEXTRACT(A1,"-*d*.?d+")

This formula will extract integers, decimals, and negative signs from a string.

The following example shows how to use this formula in practice.

Example: Extract Numbers from String in Google Sheets

Suppose we have the following list of strings in Google Sheets:

We can use the following formula to extract numbers (including integers, decimals, and negative signs) from the strings:

=REGEXEXTRACT(A2,"-*d*.?d+")

The following screenshot shows how to use this formula in practice:

extract number from string in Google Sheets

Notice that the values in column B only contain the integers, decimals, and negative signs from the values in column A.

If you ever attempt to use this formula and you receive #VALUE! as a result, make sure that the strings are formatted as Plain text.

To convert the strings to Plain text, highlight the cell range that contains the strings, then click the Format tab along the top ribbon, then click Number and then click Plain text.

This should resolve any #VALUE! issues.

Additional Resources

The following tutorials explain how to perform other common tasks in Google Sheets:

How to Extract Substring in Google Sheets
How to Substitute Multiple Values in Google Sheets
How to Count Cells with Text in Google Sheets

Related Posts