Google Sheets transpose multiple columns with multiple data into Details in Rows - google-sheets

I have a table of responses from a google form (Columns A to G).
I need to transform the data into details, to be like the data shown in column K to O.
In Sheet2!G2 , I have put the formula that still needs to split the column K, then transpose it to vertical with the "Record" refers to Column J.
The spreadsheet is here: https://docs.google.com/spreadsheets/d/13yQa2HH5D-6gJWc9NPNUEdQNkhxicfZkc7LWJC5kUME/edit#gid=457678832
Thank you for helping out.

In Cell A18 (sheet2) I entered
={"Date","Grade","Subject", "Record"; query(ArrayFormula(SPLIT(FLATTEN(datevalue(Data!C2:C)&"|"&Data!D2:D&"|"&Data!B2:B&"|"&SPLIT(Data!E2:E,", ")), "|")), "Where Col4 <>''")}
See if that works for you?

Related

Dynamically offset data of multiple rows to match the header column in Google Sheets

I'm trying to dynamically offset data of multiple rows to match the header column in Google Sheets. The first tab contains data of multiple fruits and how many are harvested on a particular day. Each fruit starts harvesting on different dates, and the dates might not be continuous.
The second tab, "Fruit bank", shows how many fruits are harvested in total for each day. Column D is a continuous set of dates. In cell E1, a QUERY formula dynamically pulls the names of the fruits so whenever a new fruit is added, it shows up here as well. In cell E2 and the rest of the row, I use VLOOKUP formulas to pull the data from the first tab. What I need help with is to write a formula on cell E2 that expands to the rest of the row so I don't have to manually type in the lookup range every time a new fruit is added.
Also, I suspect there're better functions to use than the VLOOKUP because the way VLOOKUP pulls data is very slow. I could literally see it loading even with this small dataset.
Yellow cells contain formula.
I appreciate anyone who can take a look at my spreadsheet (linked below) and see what's the best solution for this. The 3rd tab is editable.
https://docs.google.com/spreadsheets/d/14GeJKgxadInNWVVyft2gilae7HOIEvKXRop-Kz_On-Q/edit#gid=53523977
Thanks! J
Use filter(), like this:
=arrayformula(
ifna(
vlookup(
$D2:$D,
{
filter(
'Fruits data'!$B2:$AA,
'Fruits data'!$A1:$Z1 = E1
),
filter(
'Fruits data'!$A2:$Z,
'Fruits data'!$A1:$Z1 = E1
)
},
2, false
)
)
)
See your sample spreadsheet.
you can try either. added solutions here and here
=BYROW(D2:D,LAMBDA(dx,IF(dx="",,BYCOL(E1:1,LAMBDA(ex,IF(ex="",,XLOOKUP(dx,FILTER('Fruits data'!1:46,COLUMN('Fruits data'!1:1)=MATCH(ex,'Fruits data'!1:1,0)-1),FILTER('Fruits data'!1:46,'Fruits data'!1:1=ex),)))))))
OR
=MAKEARRAY(COUNTA(D2:D),COUNTA(E1:1),LAMBDA(r,c,XLOOKUP(INDEX(D2:D,r),FILTER('Fruits data'!1:46,COLUMN('Fruits data'!1:1)=MATCH(INDEX(E1:1,,c),'Fruits data'!1:1,0)-1),FILTER('Fruits data'!1:46,'Fruits data'!1:1=INDEX(E1:1,,c)),)))
try this with dates:
=ARRAYFORMULA(QUERY({
FLATTEN(FILTER('Fruits data'!A2:100, ISODD(COLUMN('Fruits data'!A2:2)))),
FLATTEN(FILTER('Fruits data'!A2:100, ISEVEN(COLUMN('Fruits data'!A2:2)))),
FLATTEN(IF(FILTER('Fruits data'!A2:100, ISEVEN(COLUMN('Fruits data'!A2:2)))="",,
FILTER('Fruits data'!A1:1, ISEVEN(COLUMN('Fruits data'!A2:2)))))},
"select Col1,sum(Col2) where Col2 is not null group by Col1 pivot Col3"))
which could be simplified:
=ARRAYFORMULA(LAMBDA(x, QUERY({
FLATTEN(FILTER(x, ISODD(COLUMN(X)))),
FLATTEN(FILTER(x, ISEVEN(COLUMN(x)))),
FLATTEN(IF(FILTER(x, ISEVEN(COLUMN(x)))="",,
FILTER(OFFSET(x, -1,,1), ISEVEN(COLUMN(x)))))},
"select Col1,sum(Col2) where Col2 is not null group by Col1
pivot Col3 label Col1'Date'"))('Fruits data'!A2:100))

Google Sheets: Arrayformula for summarizing textjoined arrays (query/filter...)

I have a problem in Google Sheets summarizing values from a column in one single cell using an Arrayformula.
I made an easy example how my data looks like (approximately) and how I want to summarize it.
In table1 you can see project_members stuffed on different projects.
Table2 shows how I want to visualize my data. In column D the unique project_ids are listed, so far so good. Now I want column E to show every member stuffed on the project I can find next to them.
[Example][1]
[1]: https://i.stack.imgur.com/1v1mk.png
I have managed to get what I want using this:
=TEXTJOIN(" , ";1;FILTER(B:B;A:A=D2))
or
=TEXTJOIN(" , ";1;QUERY(A:D;"Select B where A contains '"& D2 &"' ";0))
Now my actual dataset is way bigger than this example and data is beeing added constantly. This is why I need the formula in column E to be automated.
I have tried this:
=ARRAYFORMULA(TEXTJOIN(" , ";1;QUERY(A:D;"Select B where A contains '"& D:D &"' ";0)))
But that doesnt work.
I´m thankful for help!
solution
Try this unique arrayformula that will take into account added lines (German Notation)
=ARRAY_CONSTRAIN( transpose({transpose(unique(A2:A));arrayformula(trim(query(arrayformula(if(A2:A=transpose(unique(A2:A));B2:B&",";));;9^9)))});counta(unique(A2:A));2)
explanation about the construction
the most important step is in D2 (US notation)=arrayformula(if(A2:A10=transpose(unique(A2:A10)),B2:B10,)), then apply query(,,9*9) to gather all items in each column
See my newly added sheet ("Erik Help") and this formula there:
=ArrayFormula({A1:B1;REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(QUERY({A2:A&"~"\B2:B&","}; "Select MAX(Col2) where Col2 IS NOT NULL GROUP BY Col2 PIVOT Col1");; 9^9));"~"));"[,\s]+$";"")})
This formula is complex, and so I invite anyone who is interested to take it apart and put it back together for understanding.

How to text wrap some cells in a google sheet column?

I have a google sheet, wherein the first two columns are filled using "Arrayformula" from a pivot table. Is it possible to merge some of the cells in first column while using Arrayformula.
Below is an image of sample data which I am obtaining from the pivot. I would like to have "Porsche" from 1st column to be text wrapped for all its corresponding customer IDs.
https://i.stack.imgur.com/Pdt4I.png
Thank you
You can try using query to filter out rows where there are no Customer IDs.
Formula:
=arrayformula(query({A1:B}, "where Col2 is not null"))
Output:
If this isn't the one you want, kindly provide your expected result as I'm unsure with how you used the term "text wrapped"

Add Filter to Vlookup formula Google sheets

I know verry little about formulas
I have a Vlookup formula which is working
=ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false)))
I want to FILTER out rows if a cell in column D is empty
But not getting how or ever if possible!
I am trying
=Filter(ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false))),D2:D<>'')
Thanks
Try
=query(ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false))), "where Col2 <>''")
(assuming your data in column D is text).

Have Arrayformula({Sheet1,Sheet2}) result in same colums ? (not side by side)

question about GoogleSpreadsheets.
Arrayformula({Sheet1,Sheet2})
this formula works for me cause it MERGES the content of the two sheets into a 3rd sheet (both sheets and destination sheet have the same structure/columnsCount)
BUT my problem is :
- everything taken from Sheet1 is put on columns A to W (the formula is indeed in cell A1)
- everything from Sheet2 is put in columns X to AT !
Is there a way to display first all the content of Sheet1 and THEN right-under it add all the lines from Sheet2
To 'stack' vertically, you need to use a semi-colon
=Arrayformula({Sheet1; Sheet2})
Note that his will also import blank rows. So to filter those out you may need to wrap a query() around it.
=QUERY (Arrayformula({Sheet1; Sheet2}), "where Col1 <> '' ")
or if the first col is numerical
=QUERY (Arrayformula({Sheet1; Sheet2}), "where Col1 is not null ")

Resources