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.

Sort Each Row Individually in Excel Using a LAMBDA Formula

Sorting rows in Excel typically refers to rearranging entire datasets based on values in...

Sort by Field Labels Using the SORT and XMATCH Combo in Excel

Want to sort your Excel data by column names instead of column positions? Learn...

How to Sort Pie Slices in Google Sheets

To sort pie slices in a pie chart, you need to sort the data...

Filter Items Unique to Groups in Google Sheets

In this tutorial, we'll learn how to filter items unique to groups in Google...

More like this

How to Sort Pie Slices in Google Sheets

To sort pie slices in a pie chart, you need to sort the data...

Filter Items Unique to Groups in Google Sheets

In this tutorial, we'll learn how to filter items unique to groups in Google...

Find Common Items Across Multiple Columns in Google Sheets

This tutorial explains how to find common items across multiple columns in Google Sheets....

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.