How to create a Google Spreadsheet pivot table from multiple sheets? - google-sheets

Is it possible to create a pivot table that consolidates data from multiple sheets?

no, it's not. first, you will need to gather your data from all sheets with a query and then create your pivot table:
=QUERY({Sheet1!A:Z; Sheet2!A:Z; Shet3!A:Z}, "select * where Col1 is not null", 0)

Related

Google Sheets Pivot data with multiple columns

I'm trying to get my set of data to be pivot without using pivot table
(https://i.stack.imgur.com/H0BLJ.png)
(https://i.stack.imgur.com/3HDtB.png)
Added Solution to your sheet
formula in cell K13:
={ArrayFormula(IF(COUNTIFS({QUERY({{C2,B2};SORT({C3:C7,B3:B7},1,1,2,1)},"Select Col1")},{QUERY({{C2,B2};SORT({C3:C7,B3:B7},1,1,2,1)},"Select Col1")},ROW(A2:A7),"<="&ROW(A2:A7))>1,,{QUERY({{C2,B2};SORT({C3:C7,B3:B7},1,1,2,1)},"Select Col1")})),QUERY(SORT({{C2:C7},{B2:B7},{"Q4 2022";BYROW(filter(D3:I7,REGEXMATCH(to_TEXT(MONTH(D2:I2)),"^10$|^11$|^12$")),LAMBDA(ax,sum(ax)))},{"Q1 2023";BYROW(filter(D3:I7,REGEXMATCH(to_TEXT(MONTH(D2:I2)),"^1$|^2$|^3$")),LAMBDA(ax,sum(ax)))}},1,1,2,1),"Select Col2, Col3, Col4")}
-

How to Combine Data when Columns are Different in Google Sheet

I am trying to have a master file that contains data from 3 separate sheets. Each sheets has the same first 5 columns in order but 3 other columns are in different order in the 3 sheets. How can I combine the data when columns are located differently into one master file?
you can rearrange columns in {} array:
=QUERY({
{QA_Assignments_2021!A2:H};
{QA_Group_2021!A2:F, QA_Group_2021!H2:H, QA_Group_2021!G2:G};
{QA_LOMFCU_2021!A2:H}},
"where Col1 is not null")
or you can do it with multiple queries like:
=QUERY(
{QUERY(QA_Assignments_2021!A2:H, "select A,B,C,D,E,G,H,F");
QUERY(QA_Group_2021!A2:H, "select *");
QUERY(QA_LOMFCU_2021!A2:H, "select A,B,C,H,G,E,F,D")},
"where Col1 is not null")
player0 already provided a great idea of how you will solve your issue. If you are doing it right, it should look like the formula below:
=Query({
Query(QA_Assignments_2021!A2:AB, "select A,B,C,D,E,F,I,N,H");
Query(QA_Group_2021!A2:AB, "select A,B,C,D,E,F,T,L,R");
Query(QA_LOMFCU_2021!A2:AB, "select A,B,C,D,E,F,Y,H,S")
}, "where Col1 is not null")
Output:
Note:
The three A2:AB can be simplified into A2:N, A2:T and A2:Y respectively since you don't need the columns beyond that. But either of the two should work. Adjust the ranges and columns to be queried accordingly if needed.

Google Sheets Import Range if specific columns not blank

I have a Google Sheet tab ("Data") with columns A:Z and need to create a tab that pulls in all rows from ("Data") if columns A:N are NOT null in any of these columns.
I've tried query importrange, query+importrange, but can't crack the code:
Attempt #1: =IF(isblank("Data!A1:N1"),Importrange("https:...
","Data!A1:Z100"),,))
Attempt #2: =QUERY(IMPORTRANGE("https:...",
" Data!A1:Z1"), "select Col1 where Col1 is not Null", 0). <<this pulls the data in for that specific cell but I can't drag it down or across to get the other rows to populate
Help!
join columns A:N into one column and use TRIM
=INDEX(TRIM(FLATTEN(QUERY(TRANSPOSE(IMPORTRANGE("url", "Data!A1:N")),,9^9))))
next, add this column to the range A:Z as the last column of array {} and QUERY it
=INDEX(ARRAY_CONSTRAIN(QUERY({
IMPORTRANGE("url", "Data!A1:Z"), TRIM(FLATTEN(QUERY(TRANSPOSE(
IMPORTRANGE("url", "Data!A1:N")),,9^9)))},
"where Col27 is not null"), 9^9, 26))

Google Sheets combine two sheets merging duplicates

I have two sheets with column 1 having different materials, but column 2 has their quantities. I need to combine both of the sheets, such as the duplicate material entries would be summed together. Is it possible to do in Google Sheets, possibly with the query function?
try it like this:
=ARRAYFORMULA(QUERY({Sheet1!A1:B; Sheet2!A1:B},
"select Col1,sum(Col2)
where Col2 is not null
group by Col1
label sum(Col2)''", 0))
where column A = material and column B = quantity

Is there a way to link data by names in Google Sheets?

I am using Google Forms and Sheets to create a way of tracking services including time for some of our students. I have the forms linked to a Sheet and am able to pull the "Clock In" data and "Clock Out" data into a single sheet. My issue is: when I go to analyze using pivot tables it pulls the data from the cell of the next row (students do not necessarily clock in/out in the order they arrive). Is there a way I can link the data by name and then order by time?
Any help would be greatly appreciated!
Example Sheet
you can but not in one go because pivot tables are not so advanced. create a new sheet and paste this in A1 cell and then crate your pivot table from this sheet:
={QUERY({Combination!A1:E}, "where Col1 is not null order by Col3, toDate(Col1) , toDate(Col2)", 1),
QUERY({Combination!F1:I}, "where Col1 is not null order by Col3, toDate(Col1) desc, toDate(Col2) desc", 1)}

Resources