I have been working on a sheet for a while and I would like to use the query function of google sheet for adding the amount of the ingredients of different meals, to create an 'overall' shopping list, but it seems to be that the numbers are not added together.
I have created an example sheet of the problem to spare you from the unrelevant details, here is the link for that: https://docs.google.com/spreadsheets/d/1BHhs9XG5kX-o8pR27L64qAQ08c93bAy1g3YKNI073vY/edit?usp=sharing
Can you help me what I am missing?
use:
=QUERY(A1:C8; "select A,sum(B),C where A is not null group by A,C"; 1)
Related
I am trying to query a table and the 2 first columns should be used as reference, where the second column (user) should be unique as reference in the column A and the other columns should be summarized.
This is my table:
enter image description here
And I would like to be like this:
enter image description here
to do this I would like to create a formula that would query this data, like =SORT(QUERY(C17:K21,"SELECT SUM(A)...",0),1,true,2,false) but I am not getting the expected result, here is the google sheets link and thanks in advance to all.
Google Sheets link
tried to create a query formula
You can use a QUERY like this:
=QUERY(A1:I9,"SELECT A,B,SUM(E),SUM(F),SUM(G),SUM(H),SUM(I) group by A,B")
If you want to rename the headers, add at the end of the query: label SUM(E) 'VALUE_RECEIVED', SUM(F) 'Payable 10%' and so on
Sorry I know this question has been asked before - I have tried changing my query around but can't seem to get it to work as expected, doesn't look to be anything wrong..
I am simply trying to query data from one large master sheet into a few separate sheets. I am using importrange to get the data from sheet, and a simple select query to filter by one of the columns. If I do a select * I get all the data as expected, but can't use a WHERE clause with any column (I just need 1 of the columns, but I tried with a few different ones).
Appreciate any help!
Query:
=QUERY(IMPORTRANGE("1sNA9u2uQW-XjEKjrVS2a5LtTPCchwSuTkXfjhTJtvPk","Sheet1!B:I"),"select * WHERE 'Rank'='LTC' ")
Columns
Username Rank Time In Service TIS Time In Grade TIG Promotable Awards PLT/SQD
Source sheet: https://docs.google.com/spreadsheets/d/1sNA9u2uQW-XjEKjrVS2a5LtTPCchwSuTkXfjhTJtvPk
Test sheet: https://docs.google.com/spreadsheets/d/1UCucsfE0M4j95d_47iN0LrAhS0luv8wXVMHRVTHJHRQ
As player0 stated, you should refer to the columns by its number, you can select multiple columns and state multiple "where" statements by using Col1,Col2, etc respectively. In this case: Where Col2 = 'LTZ'
try:
=QUERY({IMPORTRANGE("1sNA9u2uQW-XjEKjrVS2a5LtTPCchwSuTkXfjhTJtvPk", "Sheet1!B:I")},
"where Col1='LTC' ", )
I have two external GSheets that are set up as room bookings with a running date in col B and the different rooms ppl can book in col C-AX for Sheet1, C-X for Sheet2, as well as my own Sheet with a list of names (let's call it NameSheet).
Example:
Goal: I want to add an extra column in NameSheet that returns all dates within the next two weeks in which a person has booked a room as well as the room info. Like this:
I used IMPORTRANGE to import both Sheets into my own Sheet (Merged_Sheet) and then merge them dynamically using a simple query formula:
=QUERY({'Sheet1'!A:AX;'Sheet2'!A:AX},"select * where Col1 <>''")
(I had to expand Sheet 2 to AX in order to merge them.)
I then set up another sheet (Date_Filter) to dynamically filter on the next two weeks:
=filter('Merged_Sheet'!A:AX,'Merged_Sheet'!B:B<=today()+7*1)
Finally, I have so far only managed to add a column in my original NameSheet that counts the number of times a there is a partial match on a name in the Merged_Sheet:
=countif(Date_Filter!A:AX,"*"&Name&"*")
Now I'm stuck on how I can return the dates & room info on a partial match (the name columns in the room sheet are "[First Name] [Last Name]" while the employee sheet is set up as "[Last Name],[First Name]") across an entire sheet. I've tried using regexmatch, filter, contains, and even the query function again, but I keep getting function errors.
I would super appreciate any formula help. :)
In a Google Sheet there are two pages with correlated data. On a third page, how can I get a list of all user names that are associated with an account that has a subscription_type=1?
Page1 (users) has columns A (name) and B (account_id).
Page2 (accounts) has columns A (account_id) and B (subscription_type)
Unfortunately, the QUERY function can only work on one sheet at a time.
You can use the FILTER function to extract from Page 1 the account-id of anybody who has a subscription_type=1
After that, you can get the name with a simple INDEX-MATCH
You can find an example here.
try:
=FILTER(A:A, IFNA(VLOOKUP(B:B, Page2!A:B, 2, 0))=1)
I am currently working to build a query from a Google sheet that will allow me to grab data from two different ranges of cells, my example is below:
=query('Form Responses'!A2:F,G2:G "Select * Where F='Yes'")
This does not work...
I want to grab data from A2:F AND G2:G within the same sheet, Form Responses.... how do I go about doing that?
you need to do it like this:
=QUERY('Form Responses'!A2:K, "select A,B,C,D,E,K,G where F='Yes'")