Google Sheet range of all cells filled in - google-sheets

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.

Related

How do I make a dynamic query?

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

Running Count of Non-Blank Cells in dynamic named range in Google Sheets

I'm trying to use a single array formula to pull a running count of non-blank cells in a dynamic range. I know how to do it with a pasted formula with simple cell addresses like so:
=COUNTIF($B$3:B3,"<>")
However, this requires you to know how many cells you'll be filling and then paste the formula to as many cells. The ranges I'm dealing with will change based on input from the user. Please see below, with desired output in green, using pasted COUNTIF functions:
Dynamic ranges are displayed as text on Row 2. Their lengths are based on input to be pasted in Col D, and these ranges would be called via INDIRECT().
Can anyone provide a way that the Countif/Countifs logic from above can be translated to an Array Formula that uses dynamic ranges?
Try below array formula-
=Arrayformula(COUNTIFS(B3:B, "<>", ROW(B3:B), "<="&ROW(B3:B)))

Google sheets; Compare data in 3 columns & rows and highlight cells if similar data

Right now I am tasked to compare similar data across 3 columns and its respective rows and then highlight them.
I was wondering whether if it is possible to format the spreadsheet so that the cells highlight on their own across their respective rows when similar data is entered into the cells.
I have attached an example in the link provided !
OK select the range you want to format then go to Format | Conditional format | Add new rule and choose the last option (Custom formula is...) under Format cells if...
Enter the following formula (adjusting range to how many rows and columns you have in your data)
=countifs($A$2:$A$18,$A2,$B$2:$B$18,$B2,$C$2:$C$18,$C2)>1
and choose the fill colour that you want.
The formula counts how many rows there are whose first three columns match the first three columns of the current row. If the result is greater than one, there is a duplicate and the current row should be formatted.

How to apply a formula to cells in a given range?

I have a sheet that is the result of a query and can return an arbitrary number of result rows (the number of columns is fixed).
I am calculating the range that corresponds to the result set. This is working well. I use it to copy the result set into my sheet.
Now that I have the results copied to my sheet I want to add a column with a formula that works against the cells in the row. How to do this? The issue is that the number of rows is not fixed, how to have the formula apply to the rows that happen to be there.
Here is a sample sheet:
Result Set is the output of the query
Report is the sheet I made with a copy of the result set
Link to Sheet
Column C is what I am trying to populate, the number of rows for Columns A and B will update each time I open the sheet.
Another way:
=arrayformula(if(A13:A<>"",A13:A&"="&B13:B,""))

VlookUp: can I reference the range to a cell value

I am using Google Docs and unfortunately it does not have a GetPivotData function. As I add more categories and subcategories to my data, the Pivot Table data will be moving (column wise).
So I took the liberty to use formulas and find the Row and Column numbers for all my ranges, so regardless of any new data, my range will expand/contract/shift with the correct data.
Now all I have left is to use a VLOOKUP to feed the data for that specific subcategory. I have a cell that shows the value for my range.... my range is D7:S100... but like I said, if I add one more subcategory, then my range will be D7:T100 and my cell will reflect this change. I want to use this cell reference in my VLOOKUP so it can be dynamic in the range.
VLOOKUP(search_key, range, index, [is_sorted])
VLOOKUP(A1, cell reference, 2, 0)
Can the range ever be a cell reference so my vlookup's range be dynamic?
Use a Named Range. This is available in Google Spreadsheets from the Data menu.
Create a named range to represent your table of data.
Give it a name like myTable or whatever you want to call it, then you can use that Name in the formula:
=VLOOKUP("BOB",myTable,2)
If you need to expand the range, just go back in to the Named Range menu and edit the existing range.
I have not tested it yet but if this is like Excel, then you can even define a named range based on a formula (typically using the Offset, COUNTA, Index and some other functions to dynamically determine the size of the range). This is probably available to Google Spreadsheets but I have only done that in Excel.
Can the range ever be a cell reference so my vlookup's range be
dynamic?
There may be better ways of achieving what you need to do, but the short answer is yes - using INDIRECT.
B1: D7:T100
=VLOOKUP(A1,INDIRECT(B1),2,0)

Resources