Google Sheets QUERY FORMULA TRANSPOSE - google-sheets

With the formula "QUERY", I want to convert the data in the "IN" table to the "OUT" table. How should I create the "QUERY" formula?

Try this:
=transpose(flatten(query(A2:B4)))
But this can also be done without query.
=TRANSPOSE(FLATTEN(A2:B4))
Reference:
TRANSPOSE
QUERY
FLATTEN

Related

Google sheets query different sheets from named range in dropdown

I have 2 sheets (sheet1 and sheet2) and have created named ranges for each of them named sheet1 and sheet2.
To query sheet1 i use the following formula:
=QUERY(sheet1, "select A,B,C")
When i want to query sheet2 i have to edit my query formula. I dont want to have to do that, instead i want to select the sheet to query from a dropdown.
In cell B2 i have created a dropdown using data validation which populates my dropdown with Sheet1 and Sheet2.
Ive then modified my query to:
=QUERY(B2, "select A,B,C")
But i get the following error:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: A
Is there a way to query each sheet by using a dropdown?
try like this:
=QUERY(INDIRECT(B2), "select A,B,C")

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"

how to count something in multiple columns in google sheets?

I need to count items per person per date in google sheets. What formula do you recommend for?
I write this but it does not work:
=countifs(A2:A11, "3/14/2020", B2:B11, "person1", D2:H11, "*")
View image:
You could use a Pivot table
Have a look at the attached spreadsheet
https://docs.google.com/spreadsheets/d/....
Please read more about how to create and use Pivot Tables
Another way is to use the mmult method to get the row totals, then follow it with a grouping or pivot query:
=ArrayFormula(query({A2:B11,mmult(n(D2:H11="*"),transpose(column(D2:H11)^0))},"select Col2,Col1,sum(Col3) group by Col2,Col1"))
or
=ArrayFormula(query({A2:B11,mmult(n(D2:H11="*"),transpose(column(D2:H11)^0))},"select Col2,sum(Col3) group by Col2 pivot Col1"))
Since the range of first criteria is only one column, succeeding criteria should also use the same range, one column.
B2:B11, "person1", D2:D11, "*", E2:E11, "*" ...
reference: Each additional range must have the same number of rows and columns as the first range (criteria_range1 argument).

In Google Sheets, how to query and sum all values which have the same description?

I am using a query formula to import data from a different sheet.
However after querying the data, I got the same code which I need to sum the episode and the value with unique formula therefore after querying only show unique code. I'm not sure how to mix the formula.
My query formula is the following:
=QUERY(Paste!A:M,"SELECT A,B,C ORDER BY C DESC LIMIT 15")
My spreadsheet link is the following:
https://docs.google.com/spreadsheets/d/1A6lGIlU147Y_0WFD7Btkq4IMuY-Z3D1HsNiTgjLjm0o/edit?usp=sharing
As above image. Under column A I have same code for FMEM1 due to my raw data separate it for some reason. I don't want the same code separated. I want unique code not separated and sum the episode and sum the value
try
=query({A3:A17,B3:B17,C3:C17},"select Col1, Sum(Col2),Sum(Col3) group by Col1 label Col1 'Code',Sum(Col2) 'Total Episode',Sum(Col3) 'Total Value'")
Screenshot

Combination of VLOOKUP and IMPORTRANGE in an array formula doesn't work

I would like to import some data with the combination of ARRAYFORMULA, VLOOKUP, and IMPORTRANGE like this:
=arrayformula(vlookup(A3:A,importrange(T3:T,"sheet1!A:AA"),21,false))
in column T, there are individual sheet URLs.
However, this doesn't work because the formula only uses sheet URL in T3 than in another row other than row 3, it says #N/A because the value in A4 doesn't appear on a sheet URL in T3, where sheet URL must be the one in T4.
How to correct the formula above?
IMPORTRANGE does not support array range reference input.
the workaround would be to use multiple IMPORTRANGEs in an array like:
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, {IMPORTRANGE(T2, "sheet1!A:AA");
IMPORTRANGE(T3, "sheet1!A:AA");
IMPORTRANGE(T4, "sheet1!A:AA")}, 21, 0), ))

Resources