Convert columns to rows and repeat row labels in google sheets - arrays

I am trying to convert table 1 to the format in table 2. How can I do it in google sheets ?
Thank you very much.
Table 1 -
Table 2 -

use:
=ARRAYFORMULA(QUERY(TO_TEXT(SPLIT(FLATTEN(
A3:A&"×"&B2:E2&"×"&TEXT(B1:E1, "dd/mm")&"×"&B3:E), "×")),
"where Col4 is not null", ))

Related

Seeking results of multi conditions in multi data column, but each condition value is just one of many in a single cell of google sheet

Please check the file first.
https://docs.google.com/spreadsheets/d/1wYq9BEESpu77wvJzQY1AE4Gmr_PhhaNFSik0ZZt8aD0/edit?usp=sharing
My purpose is:
Generating idea randomly in "Calendar" sheet base on the "Idea" sheet
The concept is:
Selecting the condition about Industry & Quality in B1 & B2 in "Calendar" sheet
Selecting the time will post on each day of week
Then the idea will be shown off based on these conditions.
In this case, any cell can has 2+ values.
We can't split values to single columns because those data can be added more value in future.
try:
=QUERY({RANDARRAY(ROWS(A2:A)), A2:G}, "select Col2 where 9=9 "&
IF(J11="",," and Col3 contains '"&J11&"' ")&
IF(J12="",," and Col4 contains '"&J12&"' ")&
IF(J13="",," and Col5 contains '"&J13&"' ")&
IF(J14="",," and Col6 contains '"&J14&"' ")&
IF(J15="",," and Col7 contains '"&J15&"' ")&
"order by Col1 limit 1")

Autofil columns in one sheet from another only if columns have data AND a specific column has a specific value in Google Sheets

I have a google sheet that autofills rows from another sheet only if the value is a specific column is "approved".
=FILTER(Responses!A:AAC,Responses!D:D="Approved")
Is it possible to combine this to somehow only display columns that aren't blank. So for example if row 1 Column D is "approved", column E is blank, and column F is "data", then the sheet will autopopulate row 1 column D and F but not E. THank you!
try:
=TRANSPOSE(QUERY(TRANSPOSE(
FILTER(Responses!A:AAC, Responses!D:D="Approved")),
"where Col2 is not null", ))
update:
=FILTER(FILTER(Responses!A:AAA, Responses!D:D="Approved"),
TRIM(QUERY(FILTER(Responses!A2:AAA, Responses!D2:D="Approved"),,9^9))<>"")

Converting two columns table into one column table in Google Sheets

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<>''")

Multiple Google sheet Querying by date

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)''")

Combine 3 sheets into one with importrange

Goal: Merge 2 sheets into the main sheet all in one sheet via importrange
Problem: All the columns are in different orders
I would like to importrange the 2 sheets in client master sheet 2 into the main sheet in one table. Is that possible while the columns are not in the same orders?
use:
={QUERY(IMPORTRANGE("1Er_6mSY5TFJ5sb_DDRc6QY3aIzqen_QfVYg3FvBFZ3I", "Sheet 2!A2:E"),
"select Col2,Col3,Col1,Col5,Col4 where Col1 is not null", 0);
QUERY(IMPORTRANGE("1Er_6mSY5TFJ5sb_DDRc6QY3aIzqen_QfVYg3FvBFZ3I", "Sheet 3!A2:E"),
"select Col2,Col4,Col1,Col3,Col5 where Col1 is not null", 0)}

Resources