Google sheets combine query syntax - google-sheets

I have this as my first query
=Query({'Cut request '!A2:S;'Out sent '!A2:S},"Select Col1,Col2,Col4,Col3,Col10,Col13,Col17,Col19 Where Col4 is not null",0)
I want to combine both with this
QUERY(leadlist!A2:Q,"Select I,M Where A is not null",0)
I tried doing this but got an "Formula parse error"
=Query(ARRAYFORMULA({'Connection request '!A2:S;'Message sent '!A2:S},"Select Col1,Col2,Col4,Col3,Col10,Col13,Col17,Col19 Where Col4 is not null",0};QUERY(leadgen!A2:Q,"Select I,M Where A is not null",0)}))
I can not figure out how to combine both to make it works
Please any help. Thanks in advance, appreciated.

With exactly the same number of columns, it will be ok (as Sergey said). For instance :
={Query({'Cut request '!A2:S;'Out sent '!A2:S},"Select Col1,Col2,Col4,Col3,Col10,Col13,Col17,Col19 Where Col4 is not null",0);QUERY(leadlist!A2:Q,"Select A,B,C,D,E,F,G,H Where A is not null",0)}

Related

Google Sheets QUERY IMPORTRANGE formula

enter link description hereI'm trying to get a return of all Active jobs but I keep getting the error message #value!; "Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: A". Here is the formula I used.
=QUERY({IMPORTRANGE("SheetKey","employeeName1!A18:V1000"); IMPORTRANGE("SheetKey","employeeName2!A19:V1000");IMPORTRANGE("SheetKey","employeeName3!A19:V1000");IMPORTRANGE("SheetKey","employeeName4!A19:V1000")},"SELECT A, B, C, D, E WHERE E = 'Active'")
I tried replicating your issue by making a copy of your provided sample sheet but apparently, the formula works after making a copy of the sheet. Please see attached screenshot.
I suggest trying to copy it first making a new sheet with the same content and see if it will also solve your problem.
use:
=QUERY({
IMPORTRANGE("SheetKey", "employeeName1!A18:V1000");
IMPORTRANGE("SheetKey", "employeeName2!A19:V1000");
IMPORTRANGE("SheetKey", "employeeName3!A19:V1000");
IMPORTRANGE("SheetKey", "employeeName4!A19:V1000")},
"select Col1,Col2,Col3,Col4,Col5
where Col5 = 'Active'")
I took out the IMPORTRANGE and just used a query formula for the other sheets and it worked perfect. Thanks for the input everybody.

Google Sheets Query combining data source

I don't know why but when put two sources in QUERY command, I get #ARG! error. Can somebody tell me why?
https://docs.google.com/spreadsheets/d/1jzhsqVD5oeokraoKcu4C2AnnlzBBVvbD_lONBKrgk-I/edit#gid=387365472
You cant ref to A, B [..] when merged input data use Col1, Col2 [..]

IMPORTRANGE returning NO_COLUMN

I am using:
=query(importrange(SHEETID,"Orders!$A$2:$X"),"select Col1 where Col23=0")
in a Google Sheets and receiving the following error:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Col23"
I have authorized the IMPORTRANGE already and it will import that data correctly when used without the query.
Any ideas as to what is causing this error?
Remove the ) before the select like this:
=query(importrange("1_WqEDk9_XKakYVdzIm0eahWpBrY4-55ez4gauolMdAo","Sheet1!$A$2:$X","select Col1 where Col23=0")

IS NOT NULL - A simple google sheets query issue

I want my google sheets query to just filter out the rows with a blank value and possibly the ones containing specific words as well
Here's an example spreadsheet, I've tried using "where B is not null" in the query but it's not working! I'm tearing my hair out over this as i'm sure it's a simple solution.
https://docs.google.com/spreadsheets/d/1xZH1MKeqLa8r1gRGL9wYHEWe02wQoNNpqqL_ca1fGf0/edit?usp=sharing
Thanks in advance for your help!
you may need to test for empty string instead of null, you can add AND to remove other values:
=QUERY(A2:B6,"select A, B where B<>'Pizza' and B<>''")
This just worked for me
=QUERY(A2:B6,"select A, B where B!='' ",0)

How do I do a date-based query in new Google Spreadsheets?

I am using the new Google Spreadsheets that was rolled out a couple of weeks back. I'm using a following query to pull data out of another spreadsheet:
=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheet/ccc?key=blablathisisanexample", "samplesheet!A:D"), "select SUM(Col4) where ( Col1 >= date '2012-1-1' ) ")
The query works perfectly well if I remove the bit 'where ( Col1 >= date '2012-1-1' )'. It will pull data and sum it correctly.
But what's wrong with my where-col1-date filter thingy? It's written the way it was in previous version of Google Spreadsheet, and it gives no error messages. It just returns a header and no result, as if it didn't find a single date. The dates in the data file are in column 1, written in format 4/7/2014, for example. This used to work in the previous version and I'm at a loss now.
I have several suggestions here. But first: Let's copy the "2012-1-1" value to a particular cell, say F5, and write it with the exact same date format az in the original spreadsheet: 1/1/2012.
Use FILTER function:
=SUM(FILTER(IMPORTRANGE("https://docs.google.com/spreadsheet/ccc?key=blablathisisanexample", "samplesheet!D:D"), IMPORTRANGE("https://docs.google.com/spreadsheet/ccc?key=blablathisisanexample", "samplesheet!A:A")>=F5))
I admit that it's not that pretty because of the two ImportRange functions, but it works for sure, I tried it.
If you insist on using QUERY then try to replace the where condition as follows:
"select SUM(Col4) where ( Col1 >= " & F5 & ")"
I haven't tried this one, but the first one (with FILTER) should work.

Resources