AI Content Creation

How to Extract Numbers From Text in Google Sheets

The number you want is sitting inside a sentence. Getting it out is easy until the cell has more than one number in it.

By FITS TeamAugust 1, 20263 min read

Invoice lines, order notes, and product titles all bury numbers inside text. "Order 4471 shipped 3 units at $19.99" holds four numbers and you only want one of them.

Sheets can pull digits out of a string. It cannot tell you which digits mattered.

The Old Way (REGEXEXTRACT)

The standard answer is a regex pattern that matches one or more digits.

=REGEXEXTRACT(A2, "\d+")

That returns the first run of digits, which is the order number, not the price. So you extend the pattern to catch decimals and a currency symbol.

=IFERROR(VALUE(REGEXEXTRACT(A2, "\$\s?([\d,]+\.?\d*)")), "")

Now it works on rows that use a dollar sign. Rows that write "19.99 USD" return blank. Rows with a thousands separator return a text value that will not add up. Rows with no match throw #N/A, which is why the IFERROR is there hiding the failures instead of fixing them.

The FITS Way (Just Ask)

With FITS, you describe which number you want instead of the pattern it happens to match.

=FITS("Return only the dollar price as a plain number, no symbols or commas. If there is no price, return blank: " & A2)

The AI reads the sentence and picks the price whether it was written as $19.99, 19.99 USD, or nineteen ninety-nine. The "return only" phrasing keeps the answer to a bare value you can sum.

The same shape works for any other number in the cell. Change the noun and you change the target.

=FITS("Return only the quantity ordered as a number: " & A2)

One formula per column, one plain sentence each, and no pattern to maintain when a supplier changes their notation.

When to Use Each

If every row is formatted identically and there is only one number in the cell, REGEXEXTRACT is free and instant. Reach for =FITS() when the cell holds several numbers, when the format varies row to row, or when you would need a different pattern per source. Related extraction jobs work the same way: extracting text between two characters, parsing an address into columns, and removing text after a character when you only need the first piece. For the full picture, read the guide to automating Google Sheets tasks you used to need regex for.

Stop Guessing Which Digits to Match

FITS puts plain-English AI formulas inside Google Sheets. Name the number you want. Get it back as a number you can sum. Free tier included.