Extract Numbers from Square Brackets in Google Sheets

In this tutorial, I’ll show you how to extract numbers from square brackets in Google Sheets. Whether your cell contains one or multiple bracketed numbers, you’ll find a reliable and easy-to-follow solution using formulas.

Extract Numbers Within Single Square Brackets

To extract numbers from square brackets when there’s only one set per cell, use the REGEXEXTRACT function:

Example:

Value in cell A1: Team A [200]

Formula:

=IFNA(VALUE(REGEXEXTRACT(A1, "\[([0-9.]+?)\]")))

Result: 200

Explanation:

  • REGEXEXTRACT(A1, "\[([0-9.]+?)\]"): Extracts the number inside the first pair of square brackets. The regular expression \[([0-9.]+?)\] matches digits (including decimals) enclosed in brackets.
  • VALUE(...): Converts the extracted text into a numeric value.
  • IFNA(...): Returns a blank if no number is found, avoiding a #N/A error.

This formula is perfect when you only need to extract the first number from square brackets in each cell.

Apply the Formula to a Column Range

Yes, you can apply this formula to a column range using ARRAYFORMULA:

=ArrayFormula(IFNA(VALUE(REGEXEXTRACT(A1:A10, "\[([0-9.]+?)\]"))))

This extracts the first number found in square brackets from each cell in the range A1:A10.

Extract Numbers from Multiple Square Brackets in a Cell

If a cell contains multiple numbers in square brackets, the previous method only extracts the first one. Here’s a formula that extracts all such numbers:

Example:

Value in cell A1: Lap 1 [200.5] Lap 2 [195.25]

Formula:

=ArrayFormula(IFERROR(VALUE(TOROW(IFERROR(REGEXEXTRACT(SPLIT(A1, "["), "^([0-9.]+?)\]")), 3))))

Result:

200.5
195.25

Step-by-Step Breakdown:

  1. SPLIT(A1, "[")
    Splits the text at every opening square bracket [.
    Result:
    {"Lap 1 ", "200.5] Lap 2 ", "195.25]"}
  2. REGEXEXTRACT(..., "^([0-9.]+?)\]")
    Extracts numbers that appear at the start of each split part, up to the closing bracket.
  3. IFERROR(...)
    Handles any errors caused by segments that don’t contain valid numbers.
  4. TOROW(..., 3)
    Converts the column of results into a single row and removes blanks.
  5. VALUE(...)
    Converts text such as "200.5" into the numeric value 200.5.
  6. Outer IFERROR(...)
    Ensures the formula still works if nothing is extracted.

This method is ideal when you need to extract multiple numbers from square brackets in a single cell.

Extract Numbers from Square Brackets in an Array of Cells

Wrapping the previous formula directly in an ARRAYFORMULA won’t work due to the use of TOROW, which isn’t compatible with array input ranges.

To handle a range (e.g., A1:A10), use the MAP and LAMBDA functions to apply the logic to each row individually:

=MAP(A1:A10, LAMBDA(text, ArrayFormula(IFERROR(VALUE(TOROW(IFERROR(REGEXEXTRACT(SPLIT(text, "["), "^([0-9.]+?)\]")), 3))))))
Formula extracting numbers from square brackets across multiple cells in Google Sheets, displaying numeric results for each row

This formula extracts numbers from square brackets in each row of the range A1:A10, returning them as individual numeric arrays.

Resources

Here are more useful tutorials for working with text and numbers 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.

Top N Products and Top N Sellers in Google Sheets (Top N of Top N)

If you’ve ever wanted to compare which sellers contribute the most to your top-selling...

Use XLOOKUP in a Structured Table in Google Sheets (Single and Multiple Conditions)

This tutorial is for users who want to apply XLOOKUP inside a structured table...

Reset SCAN by Another Column in Google Sheets and Excel

Resetting SCAN function results based on values in another column is a topic of...

How to Get the Fastest Time for Each Person in Google Sheets

Whether you’re tracking race results, event times, or any other timed activities, finding the...

More like this

Top N Products and Top N Sellers in Google Sheets (Top N of Top N)

If you’ve ever wanted to compare which sellers contribute the most to your top-selling...

Use XLOOKUP in a Structured Table in Google Sheets (Single and Multiple Conditions)

This tutorial is for users who want to apply XLOOKUP inside a structured table...

How to Get the Fastest Time for Each Person in Google Sheets

Whether you’re tracking race results, event times, or any other timed activities, finding the...

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.