What's wrong with this Google Spreadsheets QUERY? - google-sheets

I've been struggling with this Spreadsheets query problem for hours and even after rigorous googling, couldn't figure out what's wrong or how to do this properly. Here's an example of the problem:
=QUERY('Sheet2'!2:3, "select B where A="A2"")
Example Spreadsheet: https://docs.google.com/spreadsheets/d/172kaXIs0-OhWxhvI65OvnfM1jiLt6OdQVrGYDjxf6V8/edit?usp=sharing
What I'm trying to do is pull data from the Sheet2 so that I can also include the A2 cell from Sheet1 in the equation for better automation. I know there's a way to do it but I just can't seem to be able to make it work.

The syntax is two pairs of quotes (each a single and a double) around concatenation with &. Please try:
=QUERY(Sheet2!2:3, "select B where A='"&A2&"' ")
Your version should work if the actual content of A2 were A2.

Related

Query function not working beyond column Y

I'm using the Query function to pull a list of job names from a different sheet that meet certain criteria. The sheet that has the data that I am pulling the list from has 28 columns. When I try to use Column Z, AA, or AB I get the error saying that Query completed with an empty output. I know this to be false. I've tried playing with the headers and naming the columns like this: Col1,Col2 etc. to no avail. Here is a simplified version of my formula:
=Query('Job Details'!$B$1:$AB,"Select B where AA<95",1)
Why does the query come up with an empty return when I use the above formula when I know that is should not?
This formula works just fine:
=Query('Job Details'!$B$1:$AB,"Select B where I<95",1)
Here's a link:
https://docs.google.com/spreadsheets/d/1C4NSCOHjaaCrn1Cm03DTTNcepmwzQEU4Lz_9bL-Sp5w/edit?usp=sharing
All personal data has been changed. The problem formula is highlighted green in the "Job est" sheet.
Any help is greatly appreciated!!
Aaron

Using Countif, Vlookup and Importrange

I'm currently struggling with using the Countif, Vlookup and Importrage formula on Google Sheets...
I need to pull data from the raw data sheet to the data set that I'm using and can't get it right.
Formula that I have is as follows:
=countif(vlookup(A2,IMPORTRANGE("URL","Data!A2:I940"),9,false),"supplier")
I need to look up the date and then get the count for how many "Suppliers" we had on that specific dates..
Anyone having the same issue or is my brain just over worked???
I think a better choice would be to use a query formula instead.
Please follow the logic of this given formula
=QUERY({B1:D12},"select count(Col1)
where Col3=date'"&TEXT(F1,"yyyy-mm-dd")&"' and Col2='"&F2&"'
label count(Col1) '' ")
(Do adjust ranges to your needs)

SUMIFS and/or QUERY inside ARRAYFORMULA

Google spreadsheet sample: https://docs.google.com/spreadsheets/d/1MdRjm5QmKY_vaah9c3GrvH6dDOBCQX_zvCubvN0akmk/edit?usp=sharing
Im trying to get the sum of all values for each ID. The values im trying to add up are found in the Source tab while the calculations are done in the Output. My desired values are based on 2 things: ID and Date. The Id is supposed to match and the Date is supposed to be February. I tried first just using a sumif with just matching ID and it worked using this formula: =ARRAYFORMULA(IF(A2:A="",, SUMIF(Source!A:A,A2:A,Source!B:B)))
But when I add the 2nd critera and use a sumifs function, it only outputs for the first id. Here is the sumifs formula I used: =ARRAYFORMULA(SUMIFS(Source!B2:B,Source!A2:A,A2:A,Source!C2:C,">="&DATE(2021,2,1),Source!C2:C,"<="&DATE(2021,2,28)))
I tried using query as some of the answers I found online suggested to use it but it also outputs the first data only, here is the query formula I used =ARRAYFORMULA(QUERY(Source!A2:C,"select sum(B) where A = '"&Output!A2:A&"' and C >= date '"&TEXT(DATEVALUE("2/1/2021"),"yyyy-mm-dd")&"' and C <= date '"&TEXT(DATEVALUE("2/28/2021"),"yyyy-mm-dd")&"' label sum(B) '' "))
I know this is possible by making a temporary query/filter where you only include desired dates and from there I can use SUMIF, but I will be needing to make a monthly total and making 12 of these calculated temporary filters/query would take up a lot of space since we have a lot of data so I want to avoid this option if possible. Is there a better fix to this situation?
Solved by Astrotia - =arrayformula(sumif(I3:I20&month(K3:K20), A2:A6&2, J3:J20))

Google sheets query with sum returning unwanted text

Im not sure where I am making a mistake here. In the following sheet
https://docs.google.com/spreadsheets/d/1h0XR399z6OHqzyX509WwnLBiqHX4nq4FmofaJd-HoAw/edit?usp=sharing
Sheet 1 has the raw data. I am trying to sum the same in sheet based on different criteria but I am getting an issue with a simple query. In sheet order_payment_heads a simple sum query in C2 returns the su but also the text sum amount.
Feels like I am doing something really basic wrong here but any help would be great. query being used is given below
'''=QUERY(Sheet1!A:X,"select SUM(O) where H = '"&A2&"'",1)'''
in a brand new tab, try this in cell A1
=QUERY(Sheet1!A:X,"select H,V,SUM(O) where H is not null group by H,V label SUM(O)'Price Head'")
Hopefully that will get what you're after in one go. "group by" is really the only reason that query distinguishes itself from other functions.

Search for string with VLOOKUP in Google Sheets

Trying to find a particular string in a google sheet column (column A) and return the value of the cell directly to the right (column B). If tried the following, but keep getting a Formula parse error. Please advise:
=VLOOKUP(“Assessment Guide - AWG”, A16:B120,2,FALSE)
That formula looks right to me, but if you could take a screenshot of how you wrote the formula that would be helpful. Usually formula parsing issues happen when you use a semicolon instead of a comma or have an extra parenthesis or a quote in the wrong place.

Resources