Find Tab Name of Value of Cell - google-sheets

I have a Google Sheet where I'm trying to consolidate all of my data into one tab vs 57 tabs. I have the data I'm looking for all consolidated using the Query function, but is there a way to also tell which tab the data came from like Serial Number 1234 was on Order23 Tab? I like to make a link to that tab since it's a large document.
I tried looking at the =sheetName() option but that made it seem like it was specific to that one tab and I need something that populates the Tab Name based off of a value like Serial Number 1234 was on Tab13 or something.

you can print it within query itself like:
=QUERY(Order23!A:B, "select A,B,'Order23' label 'Order23'''")
so your ultimate query will be:
=QUERY({
QUERY(Order23!A:B, "select A,B,'Order23' label 'Order23'''");
QUERY(Order23!A:B, "select A,B,'Order24' label 'Order24'''");
QUERY(Order23!A:B, "select A,B,'Order25' label 'Order25'''");
etc.}, "where 1=1")

Related

Delete data validation error of dropdown in Google Sheets

I have a Google Sheets where I would like to have drop down menus in a column. When a choice is made in a drop down menu, I would like it to be no longer present in the others.
So I added a query function to subtract the values already selected. This works fine but I get an error message saying that the value is no longer present in the specific range. And this is quite normal as I am feeding the drop down menus with the data from the query function. And when I select a value in my dropdown, it disappears from the column where the query function is located.
So I would like to know if there is an alternative to not have the error message (either hide it or use another function).
Here is my sheet before filling in my drop-down menu :
And here it is after :
Here is my function:
=query(query({A2:A;C2:C}; "Select Col1, count(Col1) where Col1<>'' group by Col1"); "Select Col1 where Col2=1")
And here is the link to my Sheets if you want to check it out for yourself.
Thanks in advance for your help
Use a dedicated range for defining the available values per each drop-down separately. Insert columns to the right and use these formulas:
cell D2: =transpose(A2:A)
cell D3: =transpose( filter( A$2:A; isna(match(A$2:A; C$2:C2; 0)) ) )
Copy the formula in D3 down. Select cell C2, choose Data > Data validation and set the "List from a range" to =D2:N2. Save and reopen the dialog box to remove the dollar signs that appear by default.
Then copy cell C2 down.

How to add extra text to Query results?

I have a sheet with data that a Google Form is continually adding data to. Once the data is added, there is a subset that I need to have sectioned off to another sheet.
I'm transposing the data so it sorts vertically for each Form's data, and the problem I'm running into is that I want each vertical selection to be individually labeled with the same consistent labels and I don't think I can make CONCATENATE work in this case (I would love to be proven wrong!).
Here's a link to the sheet:
https://docs.google.com/spreadsheets/d/1efOQRlKaJlffMnLd8f8oPZxJ57wVFGwKwVY3UW0savc/edit?usp=sharing
Here's the formula I currently have in A1 on the 'Credential Request Form' sheet:
=TRANSPOSE(QUERY('Onboarding Form Responses'!A2:J,"Select F,B,C,D,G,A where A is not null order by A desc"))
This presents the data I want and in the order I want it, but without labels before the data (sorry, "label" might be the wrong word here). I've included an example of how I'd like the data to present in cells A9:A13 on the same sheet.
Is it possible to add those labels without a substantial amount of scripting?
No scripting needed.
You can use a similar formula for your needs:
=TRANSPOSE(query(ARRAYFORMULA({"Employee Name: "&'Onboarding Form Responses'!B2:B,
"Store Number: "&'Onboarding Form Responses'!F2:F,
"Parking Space: "&'Onboarding Form Responses'!G2:G}),
"Select Col1, Col2, Col3 where Col1 is not null order by Col1 desc"))
Notice that we use "Employee Name: "&'Onboarding Form Responses'!B2:B etc. for our ranges and then Col1, Col2, etc.

IMPORTRANGE: value missing?

I have been working on this issue for a few weeks now and can't seem to find a solution. I used this answer (IMPORTRANGE with CONDITIONS) to get as far as I could, but I keep getting a value error.
This is the sheet I'm working with.
My goal is to use the first tab in the sheet (All Games) to enter all the games that I come across to create a compendium. But, then I want it to automatically populate the other tabs based on certain criteria (what type of game, skills learned, etc.)
On the Warm-Ups tab you'll see the formulas I have tried. A1 is the most recent.
Here is the formula I tried:
=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1F64PMg_iFu-DaJAUaE4BkpqF4zoteknp56VfwAUe8ag/edit#gid=1359689553", "All Games!A1:A1300"),"SELECT Col1 WHERE (Col2 = 'w') ")
I am getting a value error:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Col2
you are trying to reference Col2 but you selected range A1:A1300 which is just 1 column. therefore try:
=QUERY(IMPORTRANGE("1F64PMg_iFu-DaJAUaE4BkpqF4zoteknp56VfwAUe8ag", "All Games!A1:B1300"),
"SELECT Col1 WHERE (Col2 = 'w') ")
from the brief look on your sheet, you may want use matches or contains instead of = in your QUERY
You are only importing (part of) ColumnA - so no wonder Google can't find a second column :)

Query across multiple columns within one sheet

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'")

Pivoting programatically and carrying color information in summary of Google sheets

We have a base table that looks like this, in our main sheet called "MainData".
We would like to summarize it in a new worksheet. The summary needs to be by time, in a program management mode, where the "When" becomes the main view, in the following way. We could technically get a version of the top part of the table via Pivot, but that forces a new worksheet. We would like this entire view to be in our own second sheet of choice which we can call "Summary".
Not sure where to begin with this. The GETPIVOTDATA command seems a more convenient way to control how the pivot shows without forcing a worksheet, but it's the itemization of colours etc that is confusing. In each week's listing below that week column, we'd like to show the items but their cell needs to be coloured by the Status that item is in.
Not looking for ready made solutions (although I won't revolt if that's shared), just looking for pointers for which functions to look for. Thanks muchly!
Solution:
It's quite a task... :)
I have build working solution for you.
Go to this link to grab this (2 sheets - data and report)
Explanation:
Data sheet:
I added an extra column to source data - we will need this column in further query (you can hide this column)
={"Rep Desc";ArrayFormula(if(A2:A<>"";"Count of "&A2:A;))}
Report sheet:
I added 2 extra columns (A:B) (you can hide them later) to explain better what is going on. There are 4 main parts to this solution - you are able to pack all of them into one formula, but for sake of clarification I left them separate.
Part 1 Numbers of "Open / Closes / Attn"
This is simple query - we use extra column in data source to have desire description (Count of... instead just Attn, Closed, etc)
=QUERY({INDIRECT($A$1)};$B$1;1)
string to query
select Col5, count(Col4) where Col1 is not null group by Col5 pivot Col3 label Col5 ''
Part 2 - "Sum of Point"
Its Query again put into next query to remove headers + "Sum of Points" as an extra column (using inline array - {}):
={"Sum of Points"\QUERY(QUERY({INDIRECT($A$1)};B5;1);"select * offset 1";0)}
string to query
select sum(Col4) where Col1 is not null pivot Col3
Part 3 - "Features"
It is quite complicated... If I find more time I will describe what is going on here... but for now just code:
=QUERY(
transpose(ArrayFormula(SPLIT(
transpose(SPLIT(
TEXTJOIN("^";1;transpose(
{SPLIT(join(" ## ";transpose(query(transpose(QUERY({INDIRECT($A$1)};$B$9;1));"select Col1 offset 1";0)));" #";0;1);
QUERY(ArrayFormula(IF(TRANSPOSE(query(transpose(QUERY({INDIRECT($A$1)};$B$9;1));"select * offset 1";0))<>"";
query(QUERY({INDIRECT($A$1)};$B$9;1);"select Col1";0);""));"select * offset 1";0)}
))
;"# ";0;1))
;"^")))
;
"select * offset 1";0)
Part 4 - Conditional formatting
For range D9:H apply 3 rules with corresponding color :
=INDEX(INDIRECT("data!$A:$A");MATCH(D9;INDIRECT("data!$B:$B");0);1)="Open"
=INDEX(INDIRECT("data!$A:$A");MATCH(D9;INDIRECT("data!$B:$B");0);1)="Closed"
=INDEX(INDIRECT("data!$A:$A");MATCH(D9;INDIRECT("data!$B:$B");0);1)="Attn"
OK?
Is that what you were going to achieve?
Again - this is working copy for you:
Go to this link to grab this (2 sheets - data and report)

Resources