How to Copy Only Numbers from Multiple Columns in Google Sheets

Learn how to copy only numbers from a specified numerical range across multiple columns in Google Sheets using a single formula.

Imagine you have several columns in a Google Sheets file filled with numbers, dates, and text. You want to extract only the numbers from these columns into a new range, leaving out dates and text, using a single formula. Here’s how to do it.

=ArrayFormula(
   N(range)*
   NOT(IFERROR(DATEVALUE(range)))*
   NOT(IFERROR(TIMEVALUE(range)))
)
  • range: Replace this with your actual cell range. The range can be one- or two-dimensional, but this tutorial focuses on two-dimensional ranges.

Example: Extracting Only Numbers from Multiple Columns

Let’s say you have mixed data in the range B2:E8, which includes numbers representing the number of employees present each day, along with text like “Nil” or “Holiday.” You want to extract only the numeric data into a new range, leaving other cells as 0.

Sample dataset demonstrating how to extract numbers from multiple columns in a spreadsheet

Formula:

=ArrayFormula(
   N(B2:E8)*
   NOT(IFERROR(DATEVALUE(B2:E8)))*
   NOT(IFERROR(TIMEVALUE(B2:E8)))
)
Google Sheets formula extracting and copying numbers from multiple columns into a consolidated format

How the Formula Works

This formula consists of three main components:

  1. N(range)
    • Converts all values in the range to numeric form.
    • The formula returns numbers, dates, and times as their numeric equivalents.
    • Non-numeric text is converted to 0.
  2. NOT(IFERROR(DATEVALUE(range)))
    • DATEVALUE(range) attempts to convert each value to a date.
    • Non-date values result in errors, which IFERROR replaces with 0.
    • NOT(...) converts these 0s to TRUE and date values to FALSE.
  3. NOT(IFERROR(TIMEVALUE(range)))
    • Works similarly to the above but checks for time values instead of dates.

Multiplying the outputs of these three parts:

  • Only numeric values are retained.
  • Dates and times (numeric equivalents) are excluded because they are converted to FALSE by the second and third components.

Additional Tip: Copy Numbers in a Specific Range

To copy only numbers within a specific range (e.g., between 5 and 10, inclusive), modify the formula as follows:

=ArrayFormula(
   N(B2:E8)*
   (B2:E8>=5)*
   (B2:E8<=10)*
   NOT(IFERROR(DATEVALUE(B2:E8)))*
   NOT(IFERROR(TIMEVALUE(B2:E8)))
)

Explanation of Changes

  • (range >= 5): Evaluates to TRUE for values greater than or equal to 5.
  • (rane <= 10): Evaluates to TRUE for values less than or equal to 10.
  • Multiplying these conditions ensures only numbers in the specified range are retained.

Resources

For more related tips, check out:

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.

Lookup Values Under Categories in Excel and Google Sheets

We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

Extract Items Under a Category from the Same Column in Excel

In Excel, you can use a combination of the XLOOKUP and DROP functions to...

How to Create a Searchable Table in Excel Using the FILTER Function

Finding specific records, or rows containing the required information, is straightforward in Excel using...

Time Sequences in Excel by Minute, Hour, or Second Increments

Creating time sequences, whether by hour, minute, or second increments in Excel, can be...

More like this

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

Limit Formula Expansion to a Specific Row in Google Sheets

In this tutorial, I’ll explain how to limit the expansion of an array formula...

3-D Referencing Structured Data Tables in Google Sheets

When you have several tables within a single sheet—not across multiple sheets in a...

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.