I'm currently working on a report and I'm attempting to pull in select values from a row to another spreadsheet. The twist is that I'd like to pull in that information in descending order only if a cell on that row contains a certain value.
For this report, I'm interested in pulling in data from column A, B, C, and E, only if the cell in column D is a "Yes". The data must also be listed in descending order, so essentially having a list of the top 10 people who have had the most change in ranking and are located in the Chicago office.
The formula I'm using pulls in data from that spreadsheet into another sheet for reporting purposes:
=Query('Sales'!A2:E,"Select A,B,C,E where A<>'' Order by D Desc Limit 10")
However, it pulls in the data for all columns on the sheet, regardless of whether they're in the Chicago office or not. Is there a way to single out the top 10 rows that contain the "Yes" in column S and get data for the cells in column A, B, C, E in those rows to pull in descending order into another sheet?
Link to sample sheet: https://docs.google.com/spreadsheets/d/1psaOkE2oFMsKlXSawot1zujq5HX9ziowf95cJR_O7rA/edit?usp=sharing
You probably want something like this:
=Query('Sales'!A2:U,"Select A,C,K,T where A<>'' AND S='Yes' Order by U Desc Limit 10")
Related
I'm trying to work out a function in a Google Sheets cells to look at a column then search current row and "above" the current row to find a non number value (text).
I have data that in two columns B (item code or category) & C (item description).
I need another column to contain the categories for each item - column D. I'm looking for a formula for this column, ideally an Arrayformula as the data can change, there can be multiple items per category, some might be only 1 item, some might be 100 items per category. The arrayformula in column D will get the category from column B if it is not a number.
B column - categories and item codes, C column - item descriptions, target is D column a copy of the categories from column B.
I've tried this numerous times and usually give up, do it manually but it becomes teadious quickly. Looking forward to any help that might come from this! thanks.
In D2 try
=Arrayformula(if(isnumber(B2:B), vlookup(row(B2:B), filter({row(B2:B) , B2:B}, istext(B2:B)), 2), B2:B))
and see if that works?
Try in D1
={"Category";ArrayFormula(lookup(row(B2:B),row(B2:B)/if(isnumber(B2:B),0,1),B2:B))}
I have a query formula in Google sheets that updates based on additional columns of data in my Google Sheet seen here =QUERY('Deals List - URL Split'!A:DZ, "select A, C where C contains 'http'",)
So it may add QUERY('Deals List - URL Split'!A:DZ, "select A, E where E contains 'http'",)and then it will end up becoming the below and so on for each additional.
=QUERY('Deals List - URL Split'!A:DZ, "select A, C where C contains 'http'",);QUERY('Deals List - URL Split'!A:DZ, "select A, E where E contains 'http'",)
What I am trying to do is have the resultant query formula which is in cell 'List'!A1 as QUERY('Deals List - URL Split'!A:DZ, "select A, C where C contains 'http'",);QUERY('Deals List - URL Split'!A:DZ, "select A, E where E contains 'http'",) be used in an array formula as a reference so I don't have to update the formula each time a new query formula is added.
The static query formula is
=SORT(ARRAYFORMULA({QUERY('Deals List - URL Split'!A:DZ, "select A, C where C contains 'http'",);QUERY('Deals List - URL Split'!A:DZ, "select A, E where E contains 'http'",)}),1,TRUE,2,TRUE)
and indeally the one that gets the dynamic formula would be like below but I always get an error and get just the literal static formula above.
=SORT(ARRAYFORMULA({'List'!A1}),1,TRUE,2,TRUE)
I think I have an answer (or two) for you. After looking at your sheet, I have to say that I am sure that a simpler design is possible for your sheets, that would simplify everything. Anyway, I've built one formula, using only your data on sheet '2 URL SPLIT'!, and the desired columns from '4 URL FILTER'!A1:1. See my sample tab, GK-6 ITEMS AND URLS, added to your sheet.
The formula, reduced to its basic form, is:
={
IFERROR({'2 URL SPLIT'!$A$2:$A, INDIRECT(INDEX(
{ARRAYFORMULA(IFERROR("'2 URL SPLIT'!"
& TRANSPOSE('4 URL FILTER'!1:1)
& TRANSPOSE(SPLIT(
{"2:"
& TEXTJOIN("~2:",1,TRANSPOSE('4 URL FILTER'!1:1))},"~",0,0))
& ROWS('2 URL SPLIT'!A:A)))},1,0))},{"",""})
}
The formula is not truly dynamic, but it ignores blank columns. So the cheat I've used is to expand the capacity of the formula to include extra blank columns, and if they get filled with data, the data will be used. I've set it to include 50 columns of data, where you are currently using 39, but you could expand it to handle about 200 columns, before it reaches the 50,000 character limit of a cell.
The formula as shown above handles one column. For the one that handles fifty columns, as in my sample sheet, I simply duplicate the inner formula, everything inside the outer braces "{....}" and increment the number in it. You only need to do this once, or copy mine from my sheet. You do not need to update if/when your data columns expand.
I'm happy to add much more explanation if you decide that this formula works for you. But the basis of the formula is dynamically building the ranges of cells to query. The result of this inner part of the formula is shown below. Note that the 2 in each range is hard-coded, and can be changed if your structure changes, but the limit of the range is calculated from your data.
The rest of the formula uses an index into this "table", incrementing by one to select each successive data range, which adds a new column of data to be queried. These data ranges from '2 URL SPLIT!' include column A and one subsequent data column, as specified in '4 URL FILTER'!A1:A, and are stacked one above the other, by using a ";" separator.
The query is then run against this vertical, two column stack, selecting all rows where column 2 contains "http".
The final result is shown below:
I'm working on a dynamic dashboard in Google Sheets that uses response validation to choose an student's name from a drop-down, pulling the relevant information for that particular student and adjusting the graphs/charts. One of the sections of the dashboard shows a list of events and the dates they happened, in chronological order. The order of events changes based on the order the dates happened in, which are pulling from a separate sheet (called "Database"), meaning the order of the events changes for each student.
I'm trying to create a formula that will locate the row for the currently selected student in the Database sheet, create an array with the headers of the Database sheet (for the event names) and the one row that matches the selected student's name, put that array in order by chronological date, and then transposes it so that it's a list of events in one column and their date in the other column.
I've created a copy of the dashboard and removed/edited all student information. In the sheet called "Student Tracker", I'm working in cell J7 (colored purple). It needs to pull the dates for the selected student and the header row (to label the dates) from the sheet called "studentList".
Thanks in advance for any help you can provide!
try:
=QUERY(TRANSPOSE(QUERY(studentList!A:Q,
"select E,F,G,H,I,J,K,L,M,N,O,P,Q
where A ='"&C4&"'", 1)),
"select Col1,' ',Col2
where Col2 is not null
order by Col2 label ' '''", 0)
note that columns J and K are merged so one empty column needed to be included in outer QUERY
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
I'm using a google form to populate a google sheet similar to the template here which we use for tracking discipline at a public school
https://drive.google.com/previewtemplate?id=0Agoue3Pq0fSGdDJzX0pfb25xLXlQdFp4SnBVRjVDdVE&mode=public
Teachers fill out a form when students break a rule and the results are recorded in a form
I'm trying to rearrange the data into a report where the outputs would be listed on a new sheet by how many times a given student had violated a rule rather than each instance of a rule violation.
The input table looks a lot like the one linked, but for simplicites sake you can imagine
A B C D
Last name|First name|student ID#|rule violated
The rules are filled in by a form and the teacher selects from pre-determined rule violations
For the output I'm trying to use a query to get the data to look like this
Last name|First name|student ID#|cell phone|skateboard|swearing|kissing|
Does anyone know of a way to do this with a google sheets command such a query?
You want to pivot on rule violation type: that is, make different types into separate columns. Here is a query that does this:
=query(A:E, "select A, B, C, count(E) where C is not null group by A, B, C pivot D", 1)
The query selects A,B,C, grouping by these contents, and separate the entries in D into columns, filling it with counts of violations. I included column E just to have something to run count() on. The content of that column is irrelevant; it could be empty. (Google Sheets require counting by a column that isn't otherwise selected or pivoted on, so I could not use A,B,C, or D.)