Update query array with addition or deletion of sheets - google-sheets

I'm new to coding and have been trying to find some help but may not have been searching the correct terms so I would appreciate any direction I can get!
I am using a query in multiple locations with different criteria but the same array for all. I am looking for a way for the query array to be updated as sheets are added or removed from the spreadsheet without having to do it manually each time. I would need to leave out certain sheets. This is an example of the query I am using below.
=IFERROR(QUERY({'Test Location 1'!C6:P;'Test Location 2'!C6:P;'Test Location 3'!C6:P},"SELECT Col11,Col14 WHERE Col4='Working On It' and Col5='Yellow Station'",1),"")
Test Sheet

Related

combine data from selected sheets

I have a spreadsheet that has a lot of sheets of data grouped by category. I have a main sheet that I want a user to be able to choose which categories of data to use, and it will pull that data into one long list.
Here is an example spreadsheet of what I want to do: LINK TO SHEET
I could combine all the data into one spreadsheet, but if I were to do that with the dataset I am working with, I would have tens of thousands of rows. So, having the data stored on separate sheets is preferred. I am open to having separate spreadsheets altogether if that will make it easier. Currently, I have tried Using INDIRECT and QUERY, but can only get the first sheet of data to show.
I would prefer to stick to normal functions, but could jump into appscript if I need to create a custom formula
I have tried using INDIRECT and CONCAT, and can get the first set of data, but not subsequent data. Also tried wrapping it in a query like this:
=QUERY({ARRAYFORMULA(INDIRECT(CONCAT(A2:A,"!a2:z100"))},"select * where Col1 is not null",1))
Splitting it up into separate spreadsheets, I was able to use the function:
=QUERY({ARRAYFORMULA(IMPORTRANGE(B2:B,"A1:Z10"))},"select * where Col1 is not null",1)
But it also would only pull the first set of data, not the subsequent rows.
All of this was me first attempting to get the information, not getting the information filtered by the sheets that were checked as well. I am pretty familiar with appscript as well and open to appscript solutions, but would prefer to stay away from it if possible.
You do not need additional column. Use REDUCE() with few other formula-
=REDUCE(HSTACK("Dataset Name","Data 1","Data 2","Data 3","Data 4"),FILTER(A2:A,B2:B=TRUE),
LAMBDA(x,y,VSTACK(x,QUERY(INDIRECT(y&"!A2:E"),"where A is not null"))))

Google Sheets FILTER array notation with exclusion

I'm currently using filter formula on Google sheets and am trying to find a way to exclude cells that meet a specific criteria from this.
Here is a link to what I am using, and I'm trying to get it to say, if column X is populated, exclude it from the filter.
FILTER multiple ranges/columns
I'm currently using this and it works really well, but I've been asked to exclude items, but don't know how to do this.
Example from the link in my question:
=filter({Sheet1!A13:B,Sheet1!E13:G}, Sheet1!N13:N>E2)
You can use COUNTIF, try:
=filter({Sheet1!A13:B,Sheet1!E13:G}, Sheet1!N13:N>E2, not(countif(items_to_exclude, column_where_items_to_exclude_are_located)))

Google data studio - Use multiple datasheet with same data keys/headers

So I've been stuck in this for some days, tryed a lot of search terms but all of them seems to bring me the same answers and i really need this:
I have a demand to join two different company's datas from the same owner, all of them have the same data sources (excel data sheets from FB ADS).
So they all share the same (keys/headers), like this:
COMPANY(1)'S ADS DATA
COMPANY(2)'S ADS DATA
So this way I need to put then togheter without having to join both of then on excel every time and also give him some nice data manipulation power.
The results should be something like this
By now I was trying to join data from the two companys but I couldn't really figure out how to properly do this so far I've made some tests and tryed reading a couple of articles and google data studio's help files. The merging data function seems to mess everything.
As a result of this merge, GDS gives me this fields:
Shouldn't I see like only one field labeled as cnt and cmp? I've noticed that GDS creates not one, but two data fields. If I try adding all data I need as key the left sheet turns all "0s". What Am I doing wrong here?
I have read your descriptions. It seems that you are looking for a solution to append both tables instead of merging the tables.
Do note that the data blending in GDS is a left outer join.
Hence, instead of doing the blending in GDS, I'd suggest you to append both datasets in Google Sheet in a separate tab before importing to GDS for visualisation. (assuming you don't mind copy-pasting the data into the Google Sheet).
Here is the formula to append both datasets in Google Sheets:
= {QUERY(A!A1:D1000,"SELECT A,B,C,D WHERE A <> ''",1);QUERY(B!A2:D, "SELECT A,B,C,D WHERE A <> '' ")}
I've created some dummy data in this google sheets and appended the data using the formula provided , you may take a look to understand further.
If you are unclear on the difference between merge and append, you may take a look in the Google Sheet documentation as well.
On a side note, I've screencast the process of answering this question and posted on my youtube channel. You may take a look if needed. (Thanks for the question and inspiration you provided for the video)

Inverse LOOKUP in google sheets to return column name

Good day,
I am currently sorting a storage unit, where various parts from samples are stored in multiple locations. The idea is to sort it. So I am creating a spreadsheet for each part. The columns will be the location and the rows are a list of the sample numbers of which the parts can be found in this location.
input:
A spreadsheet like this will exist for every part.
The idea is to have a final table, sorted by sample number, which has the parts in the columns. I want the cells to return where this part of this sample is stored:
desired output:
I tried various LOOKUP formulas but they do not return the column name.
Because this has to be accessible by multiple people, it has to be in google sheets.
This is an example file: https://docs.google.com/spreadsheets/d/1pUmTs0mLoZAdPc83pLXC75MCUF2P1SHDtEfYPEMohr4/edit?usp=sharing
I am super thankful for any help!
With the help of this website:
https://infoinspired.com/google-docs/spreadsheet/search-across-columns-and-return-the-header/
I found a solution. The idea is to use match functions for each column. For the example posted the code looks like this:
=ifs(isna(match(A2,'Part 1'!$A$1:$A$7,0))=FALSE,'Part 1'!$A$1,isna(match(A2,'Part 1'!$B$1:$B$7,0))=FALSE,'Part 1'!$B$1,isna(match(A2,'Part 1'!$C$1:$C$7,0))=FALSE,'Part 1'!$C$1,isna(match(A2,'Part 1'!$D$1:$D$7,0))=FALSE,'Part 1'!$D$1)
I know it is not pretty, but it works, as the number of columns is limited. The website also suggests a dynamic solution with a query function, but that only works when the cell left of the cell of interest has entries.
Thanks to everyone :-)

Count the number of occurrences of a value on a multi-page spreadsheet

The spreadsheet has many pages and more pages will be added in the future and I don't know the names of these future added. I can't just do:
=countif(Tab1!A:Z,Value1)+countif(Tab2!A:Z,Value1)+countif(Tab3!A:Z,Value1)...
because I don't know the names of these tabs to be added.
Is there a way to count the occurrences on new sheets without explicitly adding them in such a formula?
It seems that this can not be achieved using a formula. It must be written as a script. You can see an example at this question: COUNTIF Statements: Range Across All Sheets + Cell Reference as Criterion
I'm not sure if what you're trying to do is possible. But, I can help you with the getting the spreadsheet pages/sheets name part.
By using this sheets projection:
https://spreadsheets.google.com/feeds/worksheets/{spreadsheetId}/public/basic
you'll be able to get the list of all spreadsheet pages in xml format.

Resources