4.5 C
London
Thursday, December 19, 2024
HomeSoftware TutorialsGoogle SheetsGoogle Sheets: How to Extract Numbers from String

Google Sheets: How to Extract Numbers from String

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

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

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories