I want to use transpose formulae in this data
and I want desire output will look like this
try:
=QUERY(A2:B, "select max(B) where A is not null group by B pivot A")
or:
=ARRAYFORMULA(SUBSTITUTE(TRANSPOSE(SPLIT(TRANSPOSE(QUERY(QUERY(
{SUBSTITUTE(A2:A, " ", "♥"), B2:B},
"select max(Col2)
where Col1 is not null
group by Col2
pivot Col1"),,999^99)), " ")), "♥", " "))
Related
I have the following data and the work-in-progress formula
=ARRAYFORMULA({unique(A2:A);flatten(UNIQUE(filter(C2:C, A2:A=A2))&": "&countif(filter(C2:C, A2:A=A2),UNIQUE(filter(C2:C, A2:A=A2))))})
How can I go about creating the DESIRED OUTPUT from the dataset?
Google Sheet link: https://docs.google.com/spreadsheets/d/1F-ZRe0hgFWdb318xHtiIGmR-RvxSgv518k9wCUBfCm0/edit?usp=sharing
The query() function lets you get those results, although they will be tabulated in a format that is different from what you requested:
=query(A1:C, "select A, count(A) where C is not null group by A pivot C", 1)
use:
=INDEX(LAMBDA(x, y,
QUERY(FLATTEN({SORT(UNIQUE(FILTER({IFERROR(x/0, ""), x}, x<>""))),
IF(QUERY(y, "offset 1", )="",,INDEX(y, 1)&": "&QUERY(y, "offset 1", ))}),
"where Col1 is not null offset 1", ))
(A2:A, QUERY(A2:C, "select count(A) where C is not null group by A pivot C")))
Suppose I have a column of words, in some cases more than 1 word in each cell, separated by a comma or space. I want to calculate the number of words starting with A, B, C...,Z separately.
try:
=ARRAYFORMULA(QUERY(IFERROR(FLATTEN(REGEXEXTRACT(SPLIT(A1:A10; ", "); "^.")));
"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1)''"))
or:
=ARRAYFORMULA(QUERY(IFERROR(UPPER(FLATTEN(REGEXEXTRACT(SPLIT(A1:A10, ", "), "^.")))),
"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1)''"))
I can't find a way to simplify a query to get a similar result to a pivot.
Although a pivot table is easy, I would prefer to use a query because I can then personalise headers.
Here's the link with the data :
https://docs.google.com/spreadsheets/d/1R461nv2lD4efpuUuDonFMYGnLH510n7gwpbzG2WAUaw/edit?usp=sharing.
This is the working embedded queries :
= query(query(Data!A1:C, " SELECT B,count(B) WHERE B is not null GROUP BY B,C ORDER BY B ASC "), "SELECT Col1, Count(Col1) group by Col1 LABEL Col1 'Status',Count(Col1) 'Count'",1 )
This is the query I'd like to use with a pivot clause :
=query(Data!A1:C, "Select B, count(C) group by count(C) Pivot C" ,1)
Here's what I'm looking for :
Try
={"Status","Count(Categories)";transpose(query(unique(B:C),"select count(Col2) where Col2 is not null pivot Col1",1))}
or simplier
=query(unique(B:C),"select Col1, count(Col2) where Col2 is not null group by Col1",1)
if you want to pivot C column it should be:
=QUERY({Data!A1:C, Data!C1:C},
"select Col2,count(Col3) where Col1 is not null group by Col2 pivot Col4", 1)
I have a range of data on column A and B. In Column D , i have a reference for the shotID. I want to make a list for the artist involved for specific shotID.
In E2 i use this :
=JOIN( "," , FILTER($B$2:$B, $A$2:$A= D2))
then copy down to E3,E4. It works as i expected, but i want to do it using array formula. So only use single formula in E2 and that doesn't work that simple :
=arrayformula( JOIN( "," , FILTER($B$2:$B, $A$2:$A= D2:D4)) )
How can i do this ?
One more possibility that I learned from player0 and surprised he didn't suggest...
=ARRAYFORMULA(SPLIT(TRANSPOSE(SUBSTITUTE(TRIM(QUERY(QUERY(A2:B&{"|",CHAR(10)},"select MAX(Col2) where Col1<>'|' group by Col2 pivot Col1"),,100)),CHAR(10),",")),"| ",0))
take:
=ARRAYFORMULA(REGEXREPLACE(TRIM(SPLIT(SUBSTITUTE(
FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(SPLIT(
FLATTEN(A2:A&"×"&B2:B&","&"×"&B2:B), "×"),
"select Col1,max(Col2) where Col2 is not null group by Col1 pivot Col3"),
"offset 1", 0)),,9^9)), " ", "×", 1), "×")), ",$", ))
You could also try:
={unique(A2:A),arrayformula(transpose(substitute(trim(query(if(A2:A<>transpose(unique(A2:A)),,B2:B),,9^9))," ",", ")))}
I currently have a database that looks like this:
But I would like for the output of the database to look like this:
I have tried using INDEX MATCH but I haven't been able to find a way to exclude blank values from the output.
A formula I have used but have not exactly returned the expected output is:
=INDEX('Input sheet'!B2:I7,0,MATCH(A2,'Input sheet'!A2:A7,0))
Is there a formula that can return non-blank values in a row, as shown on the output sheet?
https://docs.google.com/spreadsheets/d/1HdkBPhzB5oZ0RyKZzAOkPIXT81upgHiGBLfgXsrOZDI/edit?usp=sharing
=ARRAYFORMULA({UNIQUE(FILTER('Input sheet'!A2:A, 'Input sheet'!A2:A<>"")), TRIM(SPLIT(
TRANSPOSE(QUERY(IF(QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRIM(TRANSPOSE(QUERY(
TRANSPOSE(IF(LEN('Input sheet'!B2:J), "♠"&'Input sheet'!A2:A&"♦"&'Input sheet'!B1:J1, ))
,,999^99))),,999^99), "♠")), "♦")),
"select count(Col2) where Col2 is not null group by Col2 pivot Col1",0), "offset 1",0)<>"",
QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRIM(TRANSPOSE(QUERY(
TRANSPOSE(IF(LEN('Input sheet'!B2:J), "♠"&'Input sheet'!A2:A&"♦"&'Input sheet'!B1:J1, ))
,,999^99))),,999^99), "♠")), "♦")),
"select Col2,count(Col2) where Col2 is not null group by Col2 pivot Col1", 0),
"select Col1 offset 1", 0)&"♥", ),,999^99)), "♥"))})
REVERSE OF ABOVE:
=ARRAYFORMULA(TRANSPOSE(QUERY(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(LEN('Output sheet'!B2:F), "♠"&'Output sheet'!A2:A&"♦"&'Output sheet'!B2:F, ))
,,999^99)),,999^99)), "♠")), "♦"),
"select Col2,count(Col2) where Col2 is not null group by Col2 pivot Col1", 0)))