query not resolving formula - google-sheets

I am trying to concatenate data in QUERY formula from cell as shown in image
(https://i.stack.imgur.com/3EdUX.jpg)
Formula is :=QUERY(CONCATENATE(A9,"!A2:D5"),"Select A,B")
picking data_range from another cell
how can I get it?
picking "data_range" from another cell
I want to "data_range" in query changeable

use:
=QUERY(INDIRECT(A9&"!A2:D5"); "select Col1,Col2"; )

Related

Sumif + Index/Match

Essentially I am trying to find the sum in column A that corresponds to names distributed in the array to the right. Below is a picture of what I am trying to do and what my formula is as of now. Please let me know either how to modify my formula or how to restructure my data.
enter image description here
use:
=INDEX(TRANSPOSE(QUERY(SPLIT(FLATTEN(IF(B2:G14="",,B2:G14&"×"&A2:A14)), "×"),
"select Col1,sum(Col2) where Col2 is not null group by Col1 label sum(Col2)'Totals'")))
Here is a formula I came up with that can accomplish this:
=sum(filter($A$2:$A$11, arrayformula(REGEXmatch(ARRAYFORMULA((IF(ROW($A$2:$A$11)=1,"formulaTest",$B$2:$B$11 & $C$2:$C$11 & $D$2:$D$11 & $E$2:$E$11 & $F$2:$F$11))),B13))=TRUE))
This formula should be placed in the cell below Name1, next to Totals, and then copied across the row under each name. The cell references should be changed to match your sheet/needs. Anything with $ before it defines either the duration column, or each column that contains the names. The last cell reference (B13) is a reference to the cell that contains the name you are looking to total. A screenshot of an example of this is shown at the bottom of this answer.
In simple terms, this formula combines the names from each row into a single string (per row), searches for each name within that combined string, filters the duration value if there is a match, and then sums that value.
Hope this helped! Let me know if there is anything I should explain further or better clarify.

Google spreadsheet change a cell depending on what is written on another cell

In a cell I have a list of locations made with data validation. Example Budapest, Belgrade, Bucharest.
next to the cell I have formula that i have to change manually if i change the cell with the location, EX: =index( Budapest!I:I; max(if(Budapest!B:B=E127; row(Budapest!B:B)))), =index( Belgrade!I:I; max(if(Belgrade!B:B=E127; row(Belgrade!B:B))))...etc
Is it a way to change automatically the formula, for ex if I select the city Budapest the formula to change to Budapest.
I have tried: =if(F127="Budapest"index( Budapest!I:I; max(if(Budapest!B:B=E127; row(Budapest!B:B))))) if(f127="Belgrade"index(Belgrade!F:F; max(if(Belgrade!B:B=E127; row(Belgrade!B:B)))))
if A1 = Bucharest (or whatever else) use:
=INDEX(INDIRECT(A1&"!I:I"); MAX(IF(INDIRECT(A1&"!B:B")=E127; ROW(INDIRECT(A1&"!B:B")))))
Depending on where the input data is will determine what the best formula to use it. But to be vague, the answer is yes. It will most likely require you to use a formula that pulls data and instead of the putting in a location of where to pull from, put a cell reference. Some formulas wont let you use a cell’s contents to reference a location. In that case you can concatenate the string from a cell into the formula. Here is an example of concatenation within a formula that does not allow cell references (query select where).
=QUERY('tab1'!$A$4:$R, "select * where A = '"&$C$5&"'")
It pulls all data where column A matches whatever value is typed into cell C5.
I understand this formula does not match your data but it provides an explanation of the mechanism of how to do so. I hope it helps. If not, please provide an example sheet and I can create a specific formula for your situation.

USING TEXTJOIN AND UNIQUE OVER NON-CONTINUOUS CELLS

OK, relatively simple, but frustrating for me. I think my issue isn't with the TEXTJOIN, but in defining a non-continuous series of cells for the UNIQUE function.
In cell A1, I am using this formula:
=TEXTJOIN("
",UNIQUE(B1,E1,H1,K1,N1))
NOTE: I am trying to do this for a row, and not the entire column that the data is in.
My thought was that it would join only unique values from that series, separated by a hard return.
However, I get an error.
Image of a Google Sheet error with my formula
So, looking for a way to look at a non-continuous series of cells in a row, pull out only unique values, and TEXTJOIN them together with a hard return (new line).
Your formula should be
=textjoin(" ",true,unique({B1;E1;H1;K1;N1}))
encapsulate the cells by {}
try:
=JOIN(" "; UNIQUE({B1;E1;H1;K1;N1})
or:
=QUERY(UNIQUE({B1;E1;H1;K1;N1}),,9^9)

Using ARRAYFORMULA with Multiple cell values in to one

Im trying to add few cell values to one separate (Column) Cell with Line brake for each Cell Value.
(Using Google Sheets)
The Formula im Using is
={"ID" ;ARRAYFORMULA(CONCATENATE(H2:H,CHAR(10),I2:I,CHAR(10),J2:J,CHAR(10),K2:K,CHAR(10),L2:L,CHAR(10),M2:M))}
The Issue im facing is all the data is coming on to Cell O2
Please check Image
What I want is for each row to get the values on relevant Column
Thanks in Advance
Alternatively, you can also try in O1
={"ID"; ArrayFormula(substitute(transpose(substitute(trim(query(transpose(substitute(H2:M, " ", "_")),,rows(H2:H))), " ", char(10))), "_"," "))}
I suspect you need this in cell O1:
=ARRAYFORMULA({"ID" ;H2:H&CHAR(10)&I2:I&CHAR(10)&J2:J&CHAR(10)&K2:K&CHAR(10)&L2:L&CHAR(10)&M2:M})
Probably good to add a trim as well:
=ARRAYFORMULA({"ID" ;trim(H2:H&CHAR(10)&I2:I&CHAR(10)&J2:J&CHAR(10)&K2:K&CHAR(10)&L2:L&CHAR(10)&M2:M)})

Google Sheet: Reference cell inside importhtml query

I am trying to using the following formula to import a table from ESPN:
=QUERY(IMPORTHTML("http://games.espn.com/ffl/schedule?leagueId=2127","table",2),"SELECT * WHERE Col1 = "&B3&"")
Basically, I only want to return rows that contain the value inside cell B3. However, I am having trouble getting the formula to work. It works fine when I manually type in the value instead of referencing the cell. How can I reference a cell my query?
I was able to solve this by using the below formula instead:
=QUERY(IMPORTHTML("http://games.espn.com/ffl/schedule?leagueId=2127","table",2),"SELECT * WHERE Col1 = '"&$B3&"'")

Resources