Google Sheets: Dynamic lookup across two (merged) sheets - google-sheets

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. :)

Related

Trying to auto-generate SKUs in Google Sheets using prefix and sequence number but it breaks when sheet is sorted

I want to automatically generate unique, incremented ids (SKUs) for products in my inventory using Google Sheets. These SKUs should be immutable and not change when the sheet is sorted. This screenshot shows my flawed attempt to do this:
The formula I have for column A is:
=if($B2<>"",$B2 & TEXT(COUNTIF($B$2:$B2,$B2),"-0000"),"")
That formula appears to give the desired result. However, if I sort by the values in Column C, SKUs become associated with different Item Names, which is a problem. How can I modify the spreadsheet to get immutable, auto-generated SKUs?
Update:
I would like to be able to add additional rows/SKUs to the sheet over
time
Here is a link to the sample spreadsheet
I've added a sheet ("InventoryMaster(Unsorted") to your spreadsheet.
This sheet would be used to add your prefixes and items only. Once added, you would never sort, insert rows, delete rows or items, etc. Just keep adding the next prefix and item into the next open row, in Col B and Col C. Col A has a formula that will create the static SKUs from that unchanging and ordered information. (I've hidden that formula-containing Col A, so that you only have to enter the manual data and don't have to worry about accidentally overwriting the formula or its results. It's still there at all times, serving its purpose in the background.)
Then, other sheets (see my added "Erik Help" sheet) can reference that "immutable" list, giving you the ability to sort without losing SKU connection.
Here is the A1 formula from the 'InventoryMaster(Unsorted)' sheet:
=ArrayFormula({"SKU";IF(B2:B="",,B2:B&TEXT(COUNTIFS(B2:B,B2:B,ROW(B2:B),"<="&ROW(B2:B)),"-0000"))})
And here is the SKU-assigning formula from A1 of the "Erik Help" sheet:
=ArrayFormula({"SKU";IF(B2:B="",,VLOOKUP(B2:B&C2:C,{'InventoryMaster(Unsorted)'!B2:B&'InventoryMaster(Unsorted)'!C2:C,'InventoryMaster(Unsorted)'!A2:A},2,FALSE))})

Excel Count and Multiply cells between sheets

I have 2 sheets, Sheet 1 and Sheet 2.
In Sheet 1 is a list of Vacancies in one cell and next to it is the Name of the person who has those Vacancies.
In Sheet 2 I am trying to find the TOTAL amount of Vacancies that each person listed has using a Formula
=COUNTIF(Sheet1!B:B,A2)
The only problem is that it needs to count in Sheet 1 how many vacancies a specific person has.
eg: it shows John has 3 vacancies when he should have 11.
Added a SUMIF attempt
The issue is that you should use SUMIF() instead of COUNTIF() as per the comments above, though since you are not using Excel but Google Spreadsheets, this opens up other options (note, the two look alike but are actually very different).
You could try utilize QUERY():
Formula in D1:
=QUERY(A1:B,"Select B, Sum(A) where A is not null group by B label Sum(A) 'Total Vacancies'")

Google Sheets query + array + sort + transpose?

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 a multiple sheets that use a google sheet named TOTAL as the data source?

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

How do I import data from another sheet and then filter it based on 2 different variables?

I have been working on how I budget and keep track of my finances. In the process, I put together this Google Sheet which I am happy to share a dummy version of (includes dummy data).
I use a Google Form to input new entries which are recorded in the 'Log' page.
From here, I use a few SUMIFS to pull in the totals of any given income/expense category based on the category name (referenced in the cell adjacent), the month (B3), and the year (C3).
What I now want to do is add a table (currently in columns O:Q) that calls in itemised log records based on the category selected (O2) and the month and the year. On the reference sheet these are cells (B3) and (C3) respectively and in the log, these are columns (F) and (G).
I've gotten as far as using an INDEX / SMALL array formula combination to pull in all spending as per the category selected in (O2), but what I cannot seem to figure out is how to then restrict results to only those that also match the month and year. I've tried using a MATCH formula but am unsure how to append this within the current formula string, if it is even possible?
Once working, this would (for example) mean that only rows 4 and 5 in columns O, P, and Q would be populated as these are the records for the selected month, June 2016.
Is what I want to do possible through a more complex formula? Can anybody help?
Thank you in advance.
Link to my Google Sheet: https://docs.google.com/spreadsheets/d/1_GGgFCfMtB5ROkTmpx4Fn4nZZbBIvBa4vpOwqswH5E0/edit?usp=sharing
The following should do the trick.
Delete everything in O4:Q14
In cell O4, write: =FILTER(Log!H2:H, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
In cell P4, write: =FILTER(Log!E2:E, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
In cell Q4, write: =FILTER(Log!D2:D, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
(By the way, you can generate columns F, G and maybe E from column A in the Logs sheet. For example, just remove the data that is already in column G and in G2 write: =ARRAYFORMULA(YEAR(A2:A))
Link to spreadsheet with fixes:
https://docs.google.com/spreadsheets/d/1iIplXRa28L7FdmqI91RbjApO3g-GU5uk6rTQLqi7vFw/edit#gid=0

Resources