How To IMPORTRANGE With Conditions in Google Sheets

Last Updated on October 31, 2023 by Jake Sheridan

In this tutorial, you will learn how to importrange with conditions in Google Sheets.

How To IMPORTRANGE With Conditions in Google Sheets

The IMPORTRANGE function in Google Sheets can be used to quickly and easily pull data from one sheet to another. But what if you only want to pull certain rows that meet certain conditions?

Fortunately, there is a way to use the IMPORTRANGE function with conditions.

The QUERY function in Google Sheets allows us to control what our formula will output through an easy-to-use querying syntax.

Using IMPORTRANGE and QUERY together will allow us to only import rows from our source that fit certain criteria.

This guide will show you how to use the IMPORTRANGE function with conditions in Google Sheets.

How to Use IMPORTRANGE With Conditions in Google Sheets

Here’s our step-by-step guide on how to use IMPORTRANGE with conditions in Google Sheets.

Step 1

First, head over to the source spreadsheet containing the data you want to import. Copy the URL of this document into your clipboard.

Step 2

In the destination spreadsheet, select an empty cell and type the IMPORTRANGE function.

Ensure that there is enough space around this cell to accommodate the range that you’ll be importing.

Step 3

Add the copied URL as the first parameter of the IMPORTRANGE function. We must enter the URL as a string by enclosing it with double quotes.

Step 4

Type the complete cell reference of the range you want to import. The cell reference must include the sheet name.

Step 5

Wrap the IMPORTRANGE function with a QUERY function. The QUERY function allows us to filter for certain values using the built-in query syntax.

In our example, we want to filter all rows where the credit_card_type is equal to ‘jcb’. We can set the query string “where Col3=’jcb’” to achieve this.

Note that each column in our IMPORTRANGE output can be referred to by the names Col1, Col2, and so forth.

Step 6

The QUERY function also allows us to set up two or more conditions.

In the example above, we’ve set up our QUERY function to filter for entries where the credit_card_type field is equal to “jcb” and the amount is greater than $1000.

Summary

This guide should be everything you need to learn how to importrange with conditions in Google Sheets.

You may make a copy of this example spreadsheet to test it out on your own.