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
Related
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. :)
(Note: Please simply look at the Google sheet for the quickest understanding of what I'm describing in the below bulletpoints)
My data has rows which each represent an order
Each order (row) can consist of multiple products
For each product in an order (row) there is another set of columns in the same row
I need this data to convert into only one set of columns per row (i.e. one product per row)
The products (new rows) need to remain next to eachother so the columns can't just be added to the bottom of the array (which is more simple)
Can you please take a look at the example below and help me achieve this?
Example Sheet
Screenshot of linked sheet
Try this in another sheet
=SORT({query({Reference!$A5:$A,Reference!B5:F},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!G5:K},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!L5:P},"select * where Col2 is not null ")})
I have a sheet where I am getting payment data from customers with date, name and amount. This is transactional data and more rows keep coming to it.
I need to copy that data to a different sheet in columns so that all payments for each customer come in front for their name and all payments in one month appear in total monthly payment.
This sample sheet has the input data sheets of Product and Services and Target is something I need to prepare automatically for all new entries in frist 2 sheets.
https://docs.google.com/spreadsheets/d/1YInJUkCw0TaegYKHVw6JGHKIZ9Wz6xYiOrhcIW2ya64
Welcome Kokab, I suggest to compile with that formula
={"Product/services","Receipt No","Date","customer number","Name","Code","Payment";
QUERY({
ARRAYFORMULA({IF(ISBLANK(Product!A2:A),,"Product") ,Product!A2:F});
ARRAYFORMULA({IF(ISBLANK(Services!A2:A),,"Services") ,Services!A2:F})
},"select * where Col1 <> '' order by Col2")}
then perform a pivot table as following https://docs.google.com/spreadsheets/d/19dj_A1pYm5pLqb_S69EdBfn_C3K43CanL7qPDuZLDY8/edit?usp=sharing
I have two sheets, one with product names (sorted alphabetically) in column A, stock levels in column B.
Sheet 1
The other 2nd sheet with the same products in column A and stock levels in column B but populated by "importrange" but with columns C and D manually populated with customer names.
Sheet 2
What I'd like to do is, if a new product is introduced in the 1st sheet and it is positioned alphabetically in (let's say) row 3, then have a new row appear in the 2nd sheet.
Sheet 2 ideally
Currently, if a new product is introduced, the 2nd sheet will show the product and stock level, but the manually entered data in columns C and D will then be out of sync by one row.
Sheet 2 currently
Is there a way of automatically inserting a full row when the new product is imported to the 2nd sheet if I'm using "importrange"? If there is, can someone please help me here with the formula or code.
Basically what the OP is asking is how to keep the spatial/positional relation between two data sets. One alternative is to adopt the use of "keys" and "foreign keys".
Let says that a row represents a record.
A key is an unique value that used to identify a record.
A foreign key is a value added to a record to relate it with a record from another data set
Applying the above to the question case:
On Sheet 1 add a new column to hold the key for each row. When a new record is added the key of the other records should not be changed and a new key should be assigned to the new record.
Create a table of for the values of Sheet 2, columns C and D, and add to each record a key.
NOTE: This is the table were you should do the manual input.
Create a relation table having two columns one for the keys of the records on Sheet 1 and another for the records of Sheet 2, Columns C and D.
NOTE: I will not discuss here the arity of a relation concept as it will make the answer too long.
On Sheet 2, use IMPORTRANGE to get the values from Sheet 1, including the keys for each record.
Add a lookup formula (VLOOKUP / INDEX-MATCH) to get the related records from the table created on step 2 by using the relation table created on step 3.
Related
Synchronize independent spreadsheet rows, filled by IMPORTRANGE()
Associating row data with importrange data in a new workbook on Google Sheets
I have imported some data into columns A-D using QUERY and IMPORTRANGE which is sorted asc by column A (Last name). I then want to manually add data into columns E-P. However as the original sheet is updated with new users and those new people are added to my spreadsheet, my manual data stays where it is and then belongs to the wrong person.
So if someone is added with the last name that starts with A, all the names are shifted down a row, but all the data stays in the original row. So Mr. A was added to row 2 with Mr. B's data instead of a blank row.
Is there a way to tie the data together?
This is my current function:
=QUERY(ImportRange("Sheet ID","Sheet!A:F"),"Select Col1, Col2, Col6, Col5 Where Col1<>'' and Col6 contains 'Qualifiers' Order by Col1 asc")
I want columns E-P of the new names that are added by the importrange to be blank and all the data in columns E-P to be shifted down with every person.
this is standard behaviour of Google Sheets. to counter displacement of data across rows you are supposed to implement a simple ID system and use VLOOKUP to bring up the right data for the right rows.
where Tab A!A:B will be your QUERY and Tab B!B1:B will be your E-P data and ID is the link in between harnessed by VLOOKUP formula. also you will need to change 2 to {2,3,4,5,6,7,8,9,10,11,12} coz having 2 will return you only the first ("E") column