Extract Numbers Prefixed by Currency Signs from a String in Google Sheets

Published on

If you’ve ever dealt with strings that mix words and currency values in Google Sheets, you might have found it tricky to pull out just the numbers that come after a dollar sign—or any other currency symbol.

In this post, I’ll show you how to extract numbers prefixed by currency signs from a text string in Google Sheets. Whether it’s a single value or multiple amounts scattered in a sentence, there’s a formula for it.

Why Extract Numbers Prefixed by Currency Signs?

Let’s say you have this text in a cell:

You have to pay $20.50 to Mr. A and $50 to B before 10 am.

You want to extract only the $20.50 and $50, and ignore the 10, since that’s just a time reference.

Extract the First Currency Number

If you’re just looking to grab the first number that comes after a dollar sign, this formula works:

=REGEXEXTRACT(A1, "\$(\d+(?:\.\d+)?)")

What it does:

  • Looks for a dollar sign followed by one or more digits.
  • Grabs decimal values too (like 20.50).

This returns 20.50 from the example above.

Extract the Second One

To get the second dollar amount, you can use:

=REGEXEXTRACT(A1, "\$(?:\d+(?:\.\d+)?).*?\$(\d+(?:\.\d+)?)")

This skips the first one and captures the next $-prefixed number—in this case, 50.

Extract All Currency-Prefixed Numbers

Now, what if there are more than two? You’ll need a formula that can pull out all the values dynamically.

Here’s one that works nicely:

=ArrayFormula(TOROW(REGEXEXTRACT(TO_TEXT(SPLIT(SUBSTITUTE(A1, "$", "~$"), "~")), "\$(\d+(?:\.\d+)?)"), 3))

How it works:

1. SUBSTITUTE(A1, "$", "~$") inserts a ~ before each dollar sign, creating a reliable split point.

You have to pay ~$20.50 to Mr. A and ~$50 to B before 10 am.

2. SPLIT(..., "~") breaks the text into chunks so that each dollar-prefixed number stands alone.

You have to pay$20.50 to Mr. A and$50 to B before 10 am.

3. TO_TEXT(...) ensures all parts are treated as text (important for REGEXEXTRACT to work reliably).

4. REGEXEXTRACT(..., "\$(\d+(?:\.\d+)?)") extracts the number following each dollar sign.

#N/A20.5050

5. TOROW(...) removes any #N/A or empty results and returns the final values in a single row.

Note: The purpose of TOROW here isn’t to flatten the result (the array is already one-dimensional); it’s to clean the output by removing any non-matches or blanks.

You’ll get something like:

20.5050

If you want the results in a column instead, just replace TOROW with TOCOL.

Sum the Extracted Currency Values

You can even total them with this formula:

=ArrayFormula(SUM(VALUE(TOROW(REGEXEXTRACT(TO_TEXT(SPLIT(SUBSTITUTE(A1, "$", "~$"), "~")), "\$(\d+(?:\.\d+)?)"), 3))))

This does the same extraction but wraps the results in VALUE (to convert from text to number), and then adds them up.

From our example, it returns:

70.5

Adapt for Other Currency Symbols

This approach works with other currency signs too—just replace $ in the formulas with , £, , or whatever you’re using.

For example, to extract values with the euro sign (€), use:

=ArrayFormula(TOROW(REGEXEXTRACT(TO_TEXT(SPLIT(SUBSTITUTE(A1, "€", "~€"), "~")), "\€(\d+(?:\.\d+)?)"), 3))

Conclusion

Extracting numbers prefixed by currency signs in Google Sheets doesn’t have to be complicated. With a little help from REGEXEXTRACT, SPLIT, and ARRAYFORMULA, you can quickly pull out just the values you care about—and ignore the rest.

This is especially helpful if you’re dealing with receipts, invoices, or any mixed-text fields where numbers and currency symbols live side by side.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Pivot Table Formatting, Output & Special Behavior in Google Sheets

Pivot Tables in Google Sheets are powerful—but they can get tricky once you move...

Pivot Table Calculations & Advanced Metrics in Google Sheets

When it comes to built-in tools for data analysis and visualization in Google Sheets,...

Google Sheets Pivot Table Tutorial: Basics, Setup, and Date Grouping

The easiest way to summarize, analyze, and report data in Google Sheets is by...

5 COMMENTS

  1. Worked great, thank you, one tweak I made was changing the regex to "\$([0-9.,]+)" to handle numbers bigger than 1,000.

  2. Hi Prashanth, super useful!

    I’ve been using a variation of this formula for a long time with great results, but I’ve never found an elegant solution for an arrayformula like this that can identify the MAX value in a cell with multiple $ amounts.

    Simple array formulas I use to get amounts from individual cells:
    =arrayformula(IFERROR(REGEXEXTRACT(B2:B,"(\$\S+)|(\S+\$)"),""))
    =arrayformula(iferror(0+REGEXEXTRACT(B2:B,"[0-9]*\.[0-9]+[0-9]+")

    Identifying the Max value in a cell with multiple amounts (*doesn’t expand because it has a MAX function*):

    =arrayformula(MAX(((iferror(IF(SEARCH("$",SPLIT(REGEXREPLACE(B2, "[^\$\S+]", "|"),"|")),SPLIT(REGEXREPLACE(B2, "[^\$\S+]", "|"),"|")),"")))))

    As you know, MAX won’t work in an array formula. Would you have any suggestions for a similar formula that doesn’t sum the currency amounts, but rather just extracts the maximum value??

    (This is useful for standard invoice items that usually include multiple SUBtotals adding up to a final Total)

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.