HomeGoogle DocsSpreadsheetExtract All Numbers from Text and SUM It in Google Sheets

Extract All Numbers from Text and SUM It in Google Sheets

Published on

There are two different formulas in Google Sheets that you can use to extract all numbers from Text and Sum it.

What we want are numbers from text. Even though we want to deal with numbers, without Google Sheets Text functions, we can’t achieve it.

I will explain in detail about the two Google Sheets’ formulas and you can use it on your sheet as your custom formula to extract all numbers.

No first, second or third set of numbers. These formulas can extract all sets of numbers from a text string irrespective of its position.

First, we will see how to extract all numbers from Text in Google Sheets. Then we can go to how to sum it.

Extract All Numbers from Text and SUM it

Different Formulas to Extract All Numbers from Text in Google Sheets

Cell Value in A1:

I have paid $100.25 for my blog maintenance last month and this month it’s $60.50 as forecasted.

Formula # 1 to extract all numbers from the above text. Here we are using Google Sheets Split and Concatenate function in a combined form.

=SPLIT(A1,CONCATENATE(SPLIT(A1,".0123456789")))

Formula # 2

Here is the Regexreplace and Split Combination.

=SPLIT(REGEXREPLACE(A1, "[^\d\.]+", "|"), "|")

Regexreplace and split formulas to extract numbers from text

Both the functions apply different logic in extracting all numbers from text. What are they?

Note: You can skip this part as it’s not important.

Formula # 1 Approach:

The first formula splits all texts and then join it. See there are two SPLIT functions in the formula. The second Split function then use this joined text as the delimiter to split the number.

Formula # 2 Approach:

The second REGEXREPLACE formula replaces all text with “|” and then the Split function uses this “|” as the delimiter to split the number in cell A1.

Our topic is how to extract all numbers from Text and SUM it in Google Sheets. In this the extracting all numbers from text part, we have done successfully. Now let us see how to sum the numbers extracted from the text.

How to Extract and SUM all Numbers

Just place a SUM in front of the formula as below.

Formula # 1

=SUM(SPLIT(A1,CONCATENATE(SPLIT(A1,".0123456789"))))

Formula # 2

=SUM(SPLIT(REGEXREPLACE(A1, "[^\d\.]+", "|"), "|"))

Conclusion

The above is one of the most common tasks in Google Sheets. So that learn any of the above formulae that may come very useful for you in the future.

Related:

1. How to Use Regexextract Function in Google Sheets and RE2 Regular Expressions

2. How to Use REGEXMATCH Function in Google Sheets

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

SUMPRODUCT Differences: Excel vs. Google Sheets

The core purpose of the SUMPRODUCT function remains consistent across both Excel and Google...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

3 COMMENTS

  1. Hello there,

    Your formula is amazing, but what if the numbers are negative?

    I tested it both formulas and only sum positive. ex. (Car 20, light 10, Amazon -10) result 40 instead of 20.

    Thank you very much for your help.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.