# How to Extract Numbers from String in Google Sheets

To extract numbers from a string in Google Sheets, you can use a combination of functions like REGEXEXTRACT, ARRAYFORMULA, and JOIN. Follow these steps:

- Click on an empty cell where you want to display the extracted numbers.
- Enter the following formula:

`=IFERROR(JOIN("", ARRAYFORMULA(IFERROR(REGEXEXTRACT(TO_TEXT(SPLIT(REGEXREPLACE(A1, "\d+", " "), " ")), "\d+"), ""))))`

Replace `A1`

with the cell containing the text from which you want to extract the numbers.

- Press Enter.

The formula will extract all numbers from the given string and join them together in the cell.

## Example

Let's say you have the following text in cell A1: "I have 3 apples, 7 oranges, and 12 bananas."

To extract the numbers from this text, follow these steps:

- Click on an empty cell, for example, B1.
- Enter the following formula in B1:

`=IFERROR(JOIN("", ARRAYFORMULA(IFERROR(REGEXEXTRACT(TO_TEXT(SPLIT(REGEXREPLACE(A1, "\d+", " "), " ")), "\d+"), ""))))`

- Press Enter.

The extracted numbers will be displayed in cell B1: "3712"

Did you find this useful?