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.

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

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.