Google Sheets – Using Combined IF THEN with IMPORTRANGE Formula

google sheetsimportrange

I am looking to understand what the correct syntax would be for a formula for a Google Spreadsheets that would use the IF THEN function inside of an IMPORTRANGE formula.

I want to import all of the part numbers from column C of workbook 1, sheet 1,
and stick them into column C, sheet 1 or workbook 2

I would like to see about a formula that would only pull the cells that have content, while also leaving all the additional blank cells behind.

Best Answer

I would use the following formula.

Formula

=QUERY(
   IMPORTRANGE(
     "0Anrm0HgYyzzRdGR3TWpBelFCenJYM01ZUDZsaWNsTkE", 
     "Sheet1!C3:C13"
   ),
   "SELECT Col1 WHERE Col1 <> ''"
 )

Copy/paste
=QUERY(IMPORTRANGE("0Anrm0HgYyzzRdGR3TWpBelFCenJYM01ZUDZsaWNsTkE", "Sheet1!C3:C13"),"SELECT Col1 WHERE Col1 <> ''")

Explained

The QUERY formula will take the dataset obtained from the IMPORTRANGE formula and show the first column (Col1) only where Col1 has an entry.

Example

I've added my solution into your file.

Limitations

QUERY would try to determine character/numeric type of each column. If you have columns that have mixed text and number in cells, with numbers at start, it would be decided as numeric, and text cells replaced with blanks.