This is best explained with an example:
The following sheets:
Trades:
Items:
Query:
The query in cell A3:
=Query(Trades,"Select B, C where A = 0")
What im hoping to do is then further query the itemID (only the first result column) to return its ItemName and combine that result with the ItemQty (second column).
is this possible to do?
Check out VLOOKUP - it's how to do database-like queries / joins on spreadsheet tables.
I think I got what you're after here:
Related
I'd like a formula to return all the matching values from column A if ANY of columns B-AZ equal the query value. Said differently:
=query(DATA!A:Z, "select A Where 'DATA!B:AZ' = C2").
Formulas I cobbled together, but don't work:
=query('Inv by shelf'!A:AZ,"Select A WHERE '"&C1&"' = '"&TEXTJOIN("|",1,'Inv by shelf'!$B:$AZ)&"'",1)
=filter('Inv by shelf'!A2:A,'Inv by shelf'!B:AZ = C1)
TIA!
Try FILTER() formula with MMULT().
=FILTER('Inv by shelf'!A2:A,MMULT(ArrayFormula(--('Inv by shelf'!B2:Z=C1&"")),SEQUENCE(COLUMNS('Inv by shelf'!B2:Z2),1,1,0)))
Functions references.
MMULT
SEQUENCE
FILTER
See you workbook sheet harun24hr.
I'm trying to query two separate sheets to a cell in my budget. One of the sheets is a google form I use to track my daily cash transactions, and the other is a ledger I'm using to input my bank transactions.
If I query either one of the sheets like this, either works fine:
=SUM(QUERY('Form Responses'!$A$1:$C$400,"SELECT B,C WHERE B = 'Coffee'",1))/$D$1
=SUM(QUERY(Ledger!$A$1:$C$400,"SELECT B,C WHERE B = 'Coffee'",1))/$D$1
HOWEVER, when I try to combine them like this...
=SUM(QUERY({'Form Responses'!$A$1:$C$400;Ledger!$A$1:$C$400},"SELECT B,C WHERE B = 'Coffee'",1))/$D$1
I get this error:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: B
I have gone deep into forums and SO, and have found lots of tips - but none of them work and many of them are depreciated. Can anyone solve this issue at a glance?
I don't understand how there can be a 'Column B' when they're queried individually, but not when queried together.
use:
=SUM(QUERY({'Form Responses'!$A$1:$C$400; Ledger!$A$1:$C$400},
"select Col2,Col3 where Col2 = 'Coffee'", 1))/$D$1
I have data in three columns. Column A contains a list of fruits. The second column the rank (1,2,3...) and the third column a list again but this time ordered by preference.
I want to return the rank in the fourth column. I have tried this formula which works as it should but it's returning just one value yet it's an array formula. What could be missing?
=ARRAYFORMULA(index(B2:B11,match(A2:A,C2:C11,0)))
Link to my spreadsheet.
https://docs.google.com/spreadsheets/d/1e7xCcdPa3MywDVs70o2kXAwMnzJRMDuucktWPowS_MY/edit?usp=sharing
Index doesn't work with array formulas so you have to use Vlookup instead:
=ArrayFormula(if(C2:C="","",vlookup(C2:C,A2:B,2,false)))
How do I create multiple sheets that use a Google sheet named TOTAL as the data source? Each sheet must contain the same three columns from TOTAL and other specific data, for instance, FLUX will have six columns, three from TOTAL and three custom columns added manually.
I used a query function to import the data from TOTAL to FLUX so that updating data in TOTAL will update it also in FLUX
The data in TOTAL are not fixed. It will change adding rows, which might change the order of the list. For instance, adding the row 13 in TOTAL will shift down the data in column A:C in FLUX, but not columns D:F
Is that a way to keep the reference out of the QUERY part?
Here an example: Click me
you would need to create ID system and then you would be able to match your query with rest of the static columns. in sheet SALES remove that query and put IDs in A column. then your query will be:
=QUERY(TOTAL!A1:D, "SELECT A, B, C, D WHERE C is not null", 1)
where column A contains IDs and then you create new sheet SHEET3 and paste this query in A1
and this formula in E1:
=ARRAYFORMULA(IFERROR(VLOOKUP(A1:A, SALES!A1:G, {4,5,6}, 0), ))
I have the same problem and I can't understand few steps from the answer.
Firstly, the A columns of both sheets (TOTAL and SALES) must have IDs?
Secondly, I can't really understand how the Sheets SALES should look like. Should it be like, Col A = IDs, ColB to C query from TOTAL and Col E to G static data?
In this case is it still correct creating a query in Sheet3 reading data from TOTAL?
Thank
If any of the queries in an array formula do not have actual data to query in the range they are hitting they return #VALUE! and mousing over the array formula reveals an error. If I take those queries and wrap them in an IFERROR I get the same results.
If I take what I wrapped in an IFERROR and split it out into its own cell to validate the query it results in displaying the error clause which in this case is a 0.
Here is a link to an example sheet.
Sheet1 has sample data.
Sheet2 is intentionally blank to simulate the issue described above.
Sheet3 has three queries on it in various states. The top two are the array formulas I am attempting to work with. The bottom Query is the IFERROR split out into its own cell to show that the query does in fact work when separated from the rest of the sort(arrayformula(etc)).
Try combining both ranges (from both sheets) inside 1 query instead of using 2 queries, and wrap an IFERROR() around that single query:
=ARRAYFORMULA(IFERROR(QUERY({Sheet1!A1:I500; sheet2!A1:I500}, "Select * where Col7='no'", 0), 0))
See if that works for you ?