
Use REGEXEXTRACT to pull numbers from text in Google Sheets.
By the way, we're Bardeen, we build a free AI Agent for doing repetitive tasks.
If you work with data, you might find our GPT in Spreadsheets feature useful. It helps automate data extraction and analysis, saving you time.
Extracting numbers from text in Google Sheets is a crucial skill for data analysis and automation. With the help of Regular Expressions (REGEX), you can easily pull numeric data from complex strings, saving time and effort. In this guide, we'll walk you through the process of using REGEX functions in Google Sheets to extract numbers, from basic techniques to advanced applications.
Regular Expressions (REGEX) are powerful tools for working with text data in Google Sheets. REGEX allows you to search for specific patterns within strings, extract matching data, and even replace or manipulate text based on those patterns. This makes it invaluable for data cleaning, validation, and analysis tasks.
The importance of extracting numbers from text using REGEX in Google Sheets cannot be overstated. Whether you're working with financial data, inventory records, or customer information, being able to quickly and accurately pull numeric values from complex strings can save countless hours of manual effort. GPT for Google Sheets can enhance this process.
Some key applications of REGEX for number extraction in Google Sheets include:
By mastering REGEX techniques for number extraction, you'll be able to tackle a wide variety of data preparation and analysis challenges in Google Sheets with confidence. For more advanced tasks, consider using a web scraper extension.
Google Sheets offers three primary REGEX functions to manipulate and extract data: REGEXMATCH, REGEXEXTRACT, and REGEXREPLACE. Each function serves a specific purpose in working with text strings and patterns.
REGEXMATCH tests whether a given text matches a specified regular expression pattern. It returns TRUE if a match is found anywhere in the text, and FALSE if no match is found. For example:
=REGEXMATCH("Hello World","Hello") returns TRUE=REGEXMATCH("Hello World","Goodbye") returns FALSEREGEXEXTRACT allows you to extract a portion of text that matches a regular expression pattern. It returns the first matching substring. If no match is found, it returns an #N/A error. For instance:
=REGEXEXTRACT("The price is $99.99","\\$\\d+") returns "$99.99"=REGEXEXTRACT("The price is $99.99","\\£\\d+") returns #N/AREGEXREPLACE replaces all occurrences of a regular expression pattern in a text string with a specified replacement string. It's useful for cleaning up or reformatting data. For example:
=REGEXREPLACE("Call us at 555-1234","\\d","*") returns "Call us at ***-****"=REGEXREPLACE("John Doe","(\\w+)\\s(\\w+)","$2, $1") returns "Doe, John"
By leveraging these REGEX functions in Google Sheets, you can efficiently manipulate and extract data based on patterns, saving time and effort in data cleaning and analysis tasks. For more advanced tips, you can also integrate Google Sheets with Bardeen to automate repetitive tasks.
Save time on data cleaning with Bardeen. Use our tool to connect Google Sheets and automate repetitive tasks quickly.
REGEXEXTRACT is a powerful function in Google Sheets that allows you to extract specific parts of a text string using regular expressions. In this example, we'll walk through how to use REGEXEXTRACT to pull numbers from a mixed text string.
Suppose you have a cell A1 with the following text:
The total cost is $123.45, and the tax is an additional $12.35.
To extract the numbers from this string, you can use the following formula in cell B1:
=REGEXEXTRACT(A1,"[-]?\d+\.?\d*")
Let's break down the regular expression pattern:
[-]?: Matches an optional minus sign for negative numbers.\d+: Matches one or more digits.\.?: Matches an optional decimal point.\d*: Matches zero or more digits after the decimal point.The formula will return the first number found in the string, which is "123.45". To extract the second number, you can use the following formula in cell B2:
=REGEXEXTRACT(A1,"[-]?\d+\.?\d*",2)The additional argument "2" tells REGEXEXTRACT to return the second match, which is "12.35".
By using capture groups in your regular expression, you can extract multiple values at once. For example, to extract both numbers in separate columns, use the following formula in cell B1:
=REGEXEXTRACT(A1,"([-]?\d+\.?\d*).*([-]?\d+\.?\d*)")This will return "123.45" in cell B1 and "12.35" in cell C1.
If you're looking to automate data extraction, consider using free AI web scraper tools for more complex tasks.
With this step-by-step guide, you can now use REGEXEXTRACT to pull numbers from mixed text strings in Google Sheets, including complex patterns like decimals and negatives.
REGEXREPLACE is another powerful function in Google Sheets that allows you to replace parts of a text string based on a regular expression pattern. This function is particularly useful for cleaning and formatting data, such as removing non-numeric characters from strings.
Suppose you have a cell A1 with the following text:
The price is $123.45, but after the 20% discount, it comes down to $98.76.
To remove all non-numeric characters from this string, leaving only the numbers, you can use the following formula in cell B1:
=REGEXREPLACE(A1,"[^0-9.]","")Let's break down the regular expression pattern:
[^0-9.]: Matches any character that is not a digit (0-9) or a decimal point.The second argument, "", is an empty string, which replaces all matched characters with nothing, effectively removing them.
The result in cell B1 will be:
123.4598.76
You can further refine the formula to include spaces between the numbers:
=REGEXREPLACE(A1,"[^0-9.\s]","")This will result in:
123.45 98.76
Using REGEXREPLACE to clean and format data can significantly automate data cleaning workflows and data processing. Some common scenarios include:
By mastering REGEXREPLACE, you can save time and effort in preparing your data for further analysis and reporting in Google Sheets.
Want to automate your data tasks further? Use Bardeen's automation to save time and focus on critical work.
Extracting numbers from text using REGEX functions in Google Sheets has numerous practical applications across various business scenarios. By automating the process of pulling numeric data from mixed sources, companies can streamline their workflows and gain valuable insights for decision-making.
One common use case is financial reporting. Suppose a business receives monthly sales data in a text format, with each entry containing the date, product name, and revenue generated. Using REGEXEXTRACT for phone numbers, the finance team can quickly extract the revenue figures and import them into a spreadsheet for further analysis, such as calculating total monthly revenue or identifying top-performing products.
Another application is inventory management. Consider a company that maintains a database of product information, including item codes, descriptions, and quantities in stock. The item codes often contain a mix of letters and numbers, making it challenging to sort and analyze the data. By using REGEXREPLACE to remove non-numeric characters, the inventory manager can easily extract the numeric portion of the item codes, enabling them to categorize products and monitor stock levels more effectively.
Customer data analysis is yet another area where number extraction proves invaluable. Many businesses collect customer information through online forms or surveys, which may include fields like age, phone number, and postal code. Enriching LinkedIn profiles using REGEX functions allows companies to segment their customer base, identify demographic patterns, and tailor their marketing strategies accordingly.
For example, a retail store might use REGEXEXTRACT to pull postal codes from customer addresses, enabling them to analyze sales trends by geographic region and optimize their inventory distribution.
In summary, the ability to extract numbers from text using REGEX functions in Google Sheets empowers businesses to:
By leveraging these techniques, companies can save time, reduce manual errors, and unlock the full potential of their data to drive business growth and profitability.
When working with REGEX functions in Google Sheets, users may encounter various issues that lead to unexpected results or errors. Here are some common mistakes and troubleshooting tips to ensure accurate results:
To troubleshoot issues effectively, break down your REGEX pattern into smaller components and test each part separately. This will help you identify which portion of the pattern is causing the problem. Additionally, use online REGEX testing tools to validate your patterns and ensure they match the expected results.
Bardeen can help you connect Google Docs and automate data extraction tasks. Save time by turning repetitive tasks into single-click actions.

Best practices for working with REGEX in Google Sheets include:
By following these troubleshooting tips and best practices, you can minimize errors and ensure accurate results when using REGEX functions in Google Sheets.
While the built-in REGEX functions in Google Sheets are powerful, there may be situations where you need more advanced capabilities or automation. This is where add-ons and Google Apps Script come into play.
Google Sheets add-ons are third-party extensions that provide additional functionality and features. Some popular add-ons for data extraction and manipulation include:
In addition to add-ons, Google Apps Script is a powerful tool for automating tasks and extending the functionality of Google Sheets. With Apps Script, you can write custom functions and scripts to handle complex REGEX operations and data extraction processes.
Here are a few ways you can use Apps Script to enhance your data extraction workflows:
To get started with Apps Script, you can access the script editor by selecting "Tools" > "Script editor" from the Google Sheets menu. The script editor provides a development environment where you can write and test your scripts.
When integrating add-ons or scripts into your data extraction workflows, consider the following best practices:
By leveraging add-ons and Google Apps Script, you can take your data extraction capabilities to the next level, automating complex tasks and streamlining your workflows in Google Sheets. For example, you might enhance data extraction with web scraper extensions that automate your workflows.




SOC 2 Type II, GDPR and CASA Tier 2 and 3 certified — so you can automate with confidence at any scale.
Bardeen is an automation and workflow platform designed to help GTM teams eliminate manual tasks and streamline processes. It connects and integrates with your favorite tools, enabling you to automate repetitive workflows, manage data across systems, and enhance collaboration.
Bardeen acts as a bridge to enhance and automate workflows. It can reduce your reliance on tools focused on data entry and CRM updating, lead generation and outreach, reporting and analytics, and communication and follow-ups.
Bardeen is ideal for GTM teams across various roles including Sales (SDRs, AEs), Customer Success (CSMs), Revenue Operations, Sales Engineering, and Sales Leadership.
Bardeen integrates broadly with CRMs, communication platforms, lead generation tools, project and task management tools, and customer success tools. These integrations connect workflows and ensure data flows smoothly across systems.
Bardeen supports a wide variety of use cases across different teams, such as:
Sales: Automating lead discovery, enrichment and outreach sequences. Tracking account activity and nurturing target accounts.
Customer Success: Preparing for customer meetings, analyzing engagement metrics, and managing renewals.
Revenue Operations: Monitoring lead status, ensuring data accuracy, and generating detailed activity summaries.
Sales Leadership: Creating competitive analysis reports, monitoring pipeline health, and generating daily/weekly team performance summaries.