I have multiple sheets. I want to get the data from these sheets by a date query.
I want the Result sheet as below
try:
=QUERY({Sheet1!A3:B; Sheet2!A3:B};
"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label sum(Col2)''")
Related
I'm a total beginner with doing data-analysis in google sheets. I have a sheet: (https://docs.google.com/spreadsheets/d/1WXTb14NU1IB5Dqgevrd4DaF1MoRkK1YQi58N9KRuTEA/edit?usp=sharing), that has a date column and some numeric columns.
I want to group by the date column and compute the average on the others. The sheet looks like this:
In R it could look like this:
df %>%
group_by(date) %>%
summarise(across(where(is.numeric),
~mean(.x)))
try:
=INDEX(QUERY(SPLIT(FLATTEN(A2:A&"×"&OFFSET(B2,,,9^9, 3)), "×"),
"select Col1,avg(Col2) where Col2 is not null
group by Col1 label avg(Col2)''"))
see: stackoverflow.com/q/65435313/5632629
I have 4 sheets named: STATS, SHEET01, SHEET02 and SHEET03.
SHEET01, SHEET02 and SHEET03 look exactly the same like the picture below but with different dates and percentages.
In cell A1 of the STATS sheet I have the following formula:
=IFERROR(ArrayFormula(AVERAGEIFS(SHEET01!B2:B,month(SHEET01!A2:A),2,year(SHEET01!A2:A),2020)))
This formula returns the average percentage of February 2020.
This formula clearly only works with SHEET01 and I can't figure out how to make it also take the averages of SHEET02 and SHEET03.
I have tried:
=IFERROR(ArrayFormula(AVERAGEIFS(SHEET01!B2:B,SHEET02!B2:B,SHEET03!B2:B,month(SHEET01!A2:A,SHEET02!A2:A,SHEET03!A2:A),2,year(SHEET01!A2:A,SHEET02!A2:A,SHEET03!A2:A),2020)))
UPDATE
Now using the following query:
=query({'SHEET01'!A:B;'SHEET02'!A:B;'SHEET03'!A:B},"select avg(B) Where A is not null and A>=date'2020-01-01' and A<=date'2020-01-31'")
This outputs the following error:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: B
try in B2 of stats sheet if A2:A contains dates:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A,
QUERY({SHEET01!A2:B; SHEET02!A2:B; SHEET03!A2:B},
"select Col1,avg(Col2)
where Col1 is not null
group by Col1
label avg(Col2)''"), 2, 0)))
or use only this to get the full summary:
=QUERY({SHEET01!A2:B; SHEET02!A2:B; SHEET03!A2:B},
"select Col1,avg(Col2)
where Col1 is not null
group by Col1
label avg(Col2)''")
note that you might need to format dates via 123... button if your dates will outputted as 4000+ numbers
In column A there is a list of tasks.
In column B each task has an associated group.
How to, using built-in formulas, generate sequence like in column D?
Here is a screenshot :
try:
=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(QUERY(IF(A2:B="",,A2:B&"♦"),
"select max(Col1) where Col1 is not null group by Col1 pivot Col2", 0)
,,999^99)),,999^99), "♦"))))
This should work as well as player0s. I keep trying to get him to use FLATTEN() :)
=QUERY(FLATTEN(TRANSPOSE(QUERY(A2:B,"select Max(A) group by A pivot B"))),"where Col1<>''")
I'm trying to get a pivot table, where I can select the values from something like a slicer.
I found out that using GETPIVOTDATA can get the trick with a dropdown list, but not very usefull since it's only 1 cell.
try:
=QUERY({A2:A8, INDIRECT(
ADDRESS(2, MATCH(D10, 1:1, 0))&":"&
ADDRESS(8, MATCH(D10, 1:1, 0)))},
"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label sum(Col2)''", 0)
How do I count checked checkboxes within a query in Google sheets (this is part of a group query where I want to count checked checkboxes in column B for each value of column A grouped by column A)?
try:
=ARRAYFORMULA(QUERY({A:A\ B:B*1};
"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label sum(Col2)''"))