Google Sheets Query using Checkbox as search criteria - checkbox
I want to use a query in Google Sheets that lets me look at a column of checkboxes to filter on ones that are checked (TRUE).
=QUERY(Available!$A$3:$O, "select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O where O = '"& TEXT(TRUE) &"' and B > 100,000 order by B desc")
It is complaining of a literal value, but I am having a lot of trouble figuring out the proper syntax to ensure the query is reading the checkbox properly.
try it like this:
=QUERY(Available!A3:O,
"where O = TRUE
and B > 100000
order by B desc")
if the range is A:O and you want all columns you don't need select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O
also TRUE is boolean so no need to treat it as TEXT
to fix ARRAY_LITERAL ERROR you need to build your formula like:
={IFERROR(QUERY(Available!A2:O, "select A,B,C,D,E,F,G,H,I,J,K,L,M where M like '%(Blah)' order by B desc"),
{"1","","","","","","","","","","","",""});
IFERROR(QUERY(Available!A2:O, "select A,B,C,D,E,F,G,H,I,J,K,L,M where C = 'BlehBleh' order by B desc limit 7"),
{"2","","","","","","","","","","","",""});
IFERROR(QUERY(Available!A2:O, "select A,B,C,D,E,F,G,H,I,J,K,L,M where O = TRUE and B > 100000 order by B desc"),
{"3","","","","","","","","","","","",""})}
Related
Google Sheets Query - Not like partial match
So I have this formula, and it's working as intended but I would like to further refine the data. Formula: =QUERY('Users'!A1:Q, "Select A,B,C,F,G,O,Q where Q >= 180 and Q < 44223") I have tried: =QUERY('Users'!A1:Q, "Select A,B,C,F,G,O,Q where Q >= 180 and Q < 44223 and F not like '*text*'") But that caused an error. Ideally, I would like to ommet any results that match partial texts in columns C and F. Any ideas? EDIT: Included a link to an example sheet Ideally, I want the query to match everything in column F except 'Archived' (but needs to be wildcarded) and everything in column C except Delta (again, needs to be wildcarded)
try: =QUERY(Sheet1!A1:Q6, "select A,B,C,F,G,O,Q where Q >= 180 and Q < 44223 and not lower(O) matches '.*archived.*' and not lower(C) matches '.*delta.*'")
How to show #ERROR as Zero or as Nothing in matrix cell when groups and calculated field are based on switch-function in SSRS?
Imagine simple BI task: We have two grouping columns and one calculated field. like select group1, group2, sum(sales) Sum_of_sales from dbo.table1 group by group1, group2 When for some combination of grouping columns there's no ROW in dataset - report shows me Empty. It's ok. Now i'm building matrix with groups depending on parametrs. Some sort of programmatic matrix. User deciedes what to analyze by himself. He chooses X_dimension and Y_dimension and target CalculatedField Grouping expression for first group now looks like =Switch( Parameters!param1.Value = "var1", Fields!groupingColumn1.Value, Parameters!param1.Value = "var2", Fields!groupingColumn2.Value) And for second group =Switch( Parameters!param2.Value = "var3", Fields!groupingColumn3.Value, Parameters!param2.Value = "var4", Fields!groupingColumn4.Value) With target value: =Switch( Parameters!param3.Value = "var5", Count(Fields!sales_sum.Value), Parameters!param3.Value = "var6", Sum(Fields!sales_sum.Value) ) When there are sales in combinations of groups - it's ok. It shows me exact value - like i would sum it with calculator. But when THERE'S NO DATA for some partition - it just raises error in that cell. And it seems like no way out. Pls help. P.S. I tried all possible variants such as iif(sum(...) is Nothing, 0 , sum(...)) sum(iif(value > 0 , value , 0)) and combination of them i tried comparing with ZERO, Nothing , and checking isNothing but i still get error in cell
How to return "Empty" where a query returns empty cells Google sheets
I have two columns. The first one contains names and the second some numbers. I am perfoming a query on the two columns but some of the cells in the second columns will not contain any value. I need to return "Empty" in those cells but I seem not to be able to with my formula. When I add ISBLANK to the query it throws an error. My query =query($A$1:$B$20, "select A, B where (B <=80)") Link to my spreadsheet https://docs.google.com/spreadsheets/d/12gDxvNONKYxqAPJa6FPGJMXkNv6wlXgHEMNjCg-Iuco/edit?usp=sharing
use: =ARRAYFORMULA(IF(QUERY(A1:B, "where B <=80 and A is not null")="", "Empty", QUERY(A1:B, "where B <=80"))) or: =ARRAYFORMULA(QUERY({A2:A, ""&IF((A2:A<>"")*(B2:B=""), "Empty", B2:B), B2:B}, "select Col1,Col2 where Col2='Empty' or Col3<=80", 0))
Any way in Google sheets queries to concat/append results of two columns and add text to result? (I know there is no concat within sheets queries)
I am clear that there is no concat method in google sheets queries but I'm hoping for a workaround. I've seen some suggestions for transpose but can't seem to apply them to my use, hoping for help. My actual source sheet has more complexity in columns but I've simplified it to demonstrate Existing Query =query($L$10:$N$27, "SELECT L, M WHERE N = 'Full' LABEL L 'Name', M ''",1) If Concat/Append were available it would look more like =query($L$10:$N$27, "SELECT ("Name is: " & L & " " & M) WHERE N = 'Full' LABEL L 'Name'",1) Thanks!
try: =ARRAYFORMULA(QUERY({"Name is: "&L10:L27&" "&M10:M27, N10:N27}, "select Col1 where Col2 = 'Full' label Col1 'Name'", 1))
How to nest more than one QUERY and supply one condition for all the queries
I am trying to nest Google Sheets queries but I can't seem to get it to work. I have a working formula but the problem is that it mixes students from different dates together. The formula is supposed to return all students between TODAY() and TODAY()+3 but should first be done with TODAY() students then TODAY()+1 etc. At the moment, it's listing all students from the specified dates first before moving to the nest sheet Students Level 2. I resorted to trying to nest the queries and then supply one condition at the end which I haven't succeeded in doing yet. I need the queries to share the same condition at the end so that the list orders by date. Alternatively, if there is a way of manipulating my current formula to order by date is still OK. Here is the working formula which I wish to manipulate, with your kind help: ={query('Students Level A'!A2:EC, " select EC where A is not null and not B contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ] {5}' order by EC"); query('Students Level B'!A2:EC, " select EC where A is not null and not B contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ] {5}' order by EC"); query('Students Level C'!A2:EC, " select EC where A is not null and not B contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ] {5}' order by EC")} I am looking for something along the lines of: ={query('Students Level A'!A2:EC);query('Students Level B'!A2:EC);query('Students Level C'!A2:EC), "select EC where A is not null and not B contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ] {5}' order by EC"} In this formula, I nested the queries first, then supplied a single condition for all the queries after. But this formula won't work.
you would need to do it like this: =QUERY({{'Students Level A'!A2:B, 'Students Level A'!EC2:EC}; {'Students Level B'!A2:B, 'Students Level B'!EC2:EC}; {'Students Level C'!A2:B, 'Students Level C'!EC2:EC}}, "select Col3 where Col1 is not null and not Col2 contains '-' and Col3 >= date '"&TEXT(TODAY(), "yyyy-mm-dd")&"' and Col3 <= date '"&TEXT(TODAY()+3, "yyyy-mm-dd")&"' and not Col2 matches '[\d- ] {5}' order by Col3", 0)