How do I make a dynamic query? - google-sheets

I have a summary sheet and 5 detail sheets (additional details sheets will be added). Each detail sheet has information in cells A10:G16.
I want to join those ranges from each detail sheet in a single list on the summary sheet. Right now I have the following formula in Summary sheet!b1
={DetailSheet1!A10:G16;DetailSheet2!A10:G16;DetailSheet3!A10:G16;DetailSheet4!A10:G16;DetailSheet5!A10:G16}
Which works. However, as my list of detail sheets grows, I don't want to have to go back and add another segment to the formula. I would like to just have a list of the names of each detail sheet and have the formula pull the A10:G16 range from each detail sheet in the list.

Do you want to add other future new sheets without modifying your formula?
It's not ideal to do it this way because it will be slow, but considering it is a small range and imagining your spreadsheet is not that wide, you could use this formula:
=MAKEARRAY(7*COUNTA(A:A),6,LAMBDA(r,c, INDEX (INDIRECT(INDEX(A:A,rounddown(r/7,0)+1)&"!A10:G16"),IF(MOD(r,7),MOD(r,7),7),c)))
Where you have in A:A the list of names of your sheets. Obviously you can change the range

Related

Google Sheets formula to be applied in rows where there is only numbers

I have a Google Sheets workbook, have lot of data in it in the following way as shown in the picture:
So What I want to do is to highlight all rows in which LDCP > Current (Displayed in green), that is fine when I use conditional formatting and add a formula. But since there are 1000s of such rows, what I want to do is to select all and apply that formula however when I do that it highlights the rows with text such as Leasing Companies and Leather & Tanneries.
Is there a way that I can select the whole sheet and apply a formula which only is applicable where the B column (LDCP) and F Column (Current) consists of numbers. This way only those rows will be highlighted and not the other ones.
Any other kind of advice to do this would be appreciated as well.
Regards,
~K
Try this in your conditional formatting custom formula:
=and($B1>$F1,isnumber($B1))
Range A1:Fnnn where nnn is the end of your sheet.

Google Sheet range of all cells filled in

I am creating a custom query that combines data on multiple sheets to query against. Is there a way to get all of the cells that have values? Right now I have to go into each sheet and determine the last row of cells and specifically declare the range.

How To Filter Rows Based On A List From Another Sheet? (Google Sheets)

In Excel, it is quite easy to filter rows based on a list from another sheet. But, Google Sheets does not have an advanced filter option. It therefore is not possible to filter a column by list range and criteria range in the same way that one would in Excel. So, how do you filter rows based on a list from another sheet in Google Sheets?
Worksheet to Be Filtered
Worksheet with Filter List
Select A1:C11
Create a Filter
Select A1 Filter dropdown
Custom Formula:
=OR(IFERROR(MATCH(A2,customer!A$2:A$3,0),0),IFERROR(MATCH(B2,customer!A$2:A$3,0),0))
Both A2 and B2(HGFD and MNCD and all the respective rows below) are checked against customer!A$2:A$3. If A or B contain anything from the Customer list,It'll be shown. A2 and B2 are representative of the whole A and B column.
Alternatively,
=FILTER(A1:C11,IFERROR(MATCH(A1:A11,customer!A$2:A$3,0))+IFERROR(MATCH(B1:B11,customer!A$2:A$3,0)))
This is the guide I used that worked for me in Excel:
Select a blank cell next to the rows you want to filter, and enter this formula =COUNTIF(Sheet2!$A$2:$A$6, A2), and press Enter, then
drag the auto fill handle down to apply this formula to the cells.
Select the column including the formulas, and then click Data > Filter to apply Filter function.
Click the Filter icon in the formula column, only check 1 in the drop down list.
Click OK. Now the rows have been filter based on the list in Sheet2.

Google Sheets: Formulas over multiple sheets

Is it possible to grab the contents of a cell from one sheet and display them on another?
I have 4 sheets. And I want the cells of the third sheet to display the first column of the second sheet on the second column.
if you want to get range from another sheet just use:
Replace 'Sheet' and 'A2:C8' with title and range you want to refer
={Sheet!A2:C8}
For multiple sheets
Replace ';' with ',' for horizontal view:
={Sheet!A2:C8;Sheet1!A2:C8;Sheet2!A2:C8}
Add the sheetname exclamation point to your cell reference
e.g. sheet!A:1
Then drag from the first cell down to as many rows as you need.
Google Sheets allows reference between sheets. the syntax is pretty simple. consider a single cell: =<sheetname>!A2 for example. From there, you can drag down with the bottom right corner, and your your column will now be a copy of an arbitrary column in , in this case A
These are the annotations for cells in google sheets
Sheetname!A:1 For Relative Cells
Sheetname!$A:1 For Absolute Columns
Sheetname!A:$1 For Absolute Rows
Sheetname!$A:$1 For Absolute Cells
Yes. For specific ranges you can use IMPORTRANGE.
Is it possible to grab the contents of a cell from one sheet and display them on another?
Yes. It's even possible to get entire columns of data.
In sheet 2 A1,
=ARRAYFORMULA('Sheet1'!A:A)
The single quotes ' can be omitted, if the sheet name doesn't have a space . In other words, if you use Monthly Budget as a sheet name, then single quotes is mandatory.

Conditional formatting based on cells matching a column of another sheet

I've got a spreadsheet made on Google Sheets that contains 11 sheets, and each sheet is a set of things that I'm considering buying.
Some sets contain the same individual pieces as something else.
For example item A might be on sheet A and sheet D.
I'd like to make some kind of formula to highlight all duplicates, so that when I was looking through the sheet I could see whether buying item A will help me complete more than just the set that I'm looking at. So I can look at a set and if it's mostly green I know there's more value in buying it as almost all of the contents will also go towards another set.
I know how to do it so that they glow if they match on the same sheet.
$A2=$B2
However I'm not sure how to do it across sheets, or how I'd include if statements. As the colour would have to change if it matches any cells in column A on any sheet. They're also not in the same order on different sheets so while item A might be in A3 on sheet A, it might be in A17 on sheet D.
I'm not sure how possible something like this is, but I'd appreciate any help.
Google Sheets does not allow direct references to cells in other sheets in conditional formatting formulas. But this can be circumvented with indirect:
= A2 = indirect("Sheet2!A2")
formats the current cell (A2) if it's the same as the contend of A2 on Sheet2.
But you want to check whether the content is duplicated anywhere in column A of another sheet. This can be done with match: select the column A2:A of the present sheet, and add conditional formatting with custom formula
=match(A2, indirect("Sheet2!A2:A"), 0) > 0
Here match returns either the position of found element (a positive number) or #N/A, and the formula evaluates to True in the former case only.
Although the formula says "A2", it can be applied at once to any range that has A2 as its upper left corner.

Resources