Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

See the two workbooks I created:

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.

share|improve this question
If the cell doesn't have content, then it will pull a blank cell. There is no need to specify that in the formula. – Karthik VU Dec 16 '13 at 4:08
I understand that if the cell is empty it will leave the corresponding cell blank. I was hoping to be able to omit all the empty cells during the import. – WinterWierdo Dec 16 '13 at 4:49
up vote 3 down vote accepted

I would use the following formula.


   "SELECT Col1 WHERE Col1 <> ''"

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


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


I've added my solution into your file.


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.

share|improve this answer
hey @jacob thanks for your help! – WinterWierdo Dec 18 '13 at 2:41
would you also be able to help me with a QUERY formula to pull a column from same workbook, different sheet? I cant seem to understand it... – WinterWierdo Dec 18 '13 at 2:45

Use =filter(A8:A15,A8:A15<>"") but replace A8:A15 with the import.

So =filter(ImportRange("0Anrm0HgYyzzRdGR3TWpBelFCenJYM01ZUDZsaWNsTkE";"Sheet1!C3:C13"),ImportRange("0Anrm0HgYyzzRdGR3TWpBelFCenJYM01ZUDZsaWNsTkE";"Sheet1!C3:C13")<>"")

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.