I have an input like below in Google Sheet:
I need to generate rows and columns with the above available data given below:
Conditions and tried formula:
WORKED - To reverse and transpose column 'Items' from input to generated column 'Item Order' in output. Below formula is used for that and worked.
=
Filter(
{
TRIM(FILTER(TRANSPOSE(C2:F2),TRANSPOSE(C2:F2)<>""));
QUERY(SORT(TRANSPOSE(C3:F3),SEQUENCE(COLUMNS(C3:F3)),),"where Col1 is not null",0)
},
{
FILTER(TRANSPOSE(C2:F2),TRANSPOSE(C2:F2)<>"");
QUERY(SORT(TRANSPOSE(C3:F3),SEQUENCE(COLUMNS(C3:F3)),),"where Col1 is not null",0)
}<>"
")
I need to generate column 'Side' and 'Row' in output for respective items from input. Here, the last item in front side needs to be assigned 'Right End' and the first item in back side needs to be assigned 'Left End'. I'm not sure how to include this logic for generating these columns to above formula.
Try
={arrayformula(split({flatten(OFFSET(C2,,,,COUNTA(C2:G2)-1)&"|"&B2&"|"&A2);OFFSET(C2,,COUNTA(C2:G2)-1)&"|right end|"&A2},"|"));
query(sort(arrayformula(split({column(C3)&"|"&C3&"|left end|"&A3;
flatten(column(OFFSET(C3,,1,,COUNTA(C3:G3)-1))&"|"&OFFSET(C3,,1,,COUNTA(C3:G3)-1)&"|"&B3&"|"&A3)},"|")),1,false),"select Col2,Col3,Col4")}
Related
I have been trying to filter for unique values from one tab to another. However in both tabs, I have an ID Column. I basically want to align the Unique values to their respective ID Number, then use the filter view to hide the blanks.
Any help will be appreciated.
Thanks
I used this formula:
={"PO#","MP#";ARRAYFORMULA(IFERROR(VLOOKUP(A4:A,'SHEET1'!A5:H,{7,8},0)))}
and came up with this:
={"PO#","MP#";ARRAYFORMULA(IFERROR(VLOOKUP(A4:A,FILTER('SHEET1'!A5:H,UNIQUE('SHEET1'!G5:G)),{7,8},0)))}
PO# and MP# in the second tab are the values with duplicates and will be imported from SHEET1's Column G and H respectively. Both tab's ID Column are in Column A (They just start in different positions).
I expected the rows with duplicated PO# and MP# to be blank, until the next unique row.
I have also linked a Google Sheets here to illustrate my problem.
Thanks
One way is to use vlookup() and unique(), like this:
={ Sheet1!A1:A }
=arrayformula(
iferror(
vlookup(
A1:A,
vlookup(
unique(Sheet1!B1:B),
{ Sheet1!B1:B, Sheet1!A1:C },
sequence(1, columns(Sheet1!A1:C), 2),
false
),
{ 2, 3 },
false
)
)
)
See the Solution tab.
Added formula to your sheet:
=BYROW(A2:A,LAMBDA(z,IF(z="",,INDEX(IFNA(VLOOKUP(z,FILTER({Sheet1!A:C},BYROW(Sheet1!B:B,LAMBDA(Σ,COUNTIF(Sheet1!B1:Σ,Σ)))=1),{2,3},))))))
in this example table, I want to get the first "failed" or "passed" from result 1, 2, and 3 column. I already made a formula to get the first mentioned value using:
=IF(C2=C2,CELL("address",INDEX(D2:F2,MATCH(C2,D2:F2,0))),)
which works fine (the column result is from that formula)
But when I'm trying to use ArrayFormula on the formula, it only shows the first row value only. my ArrayFormula is like this:
=ArrayFormula(IF(C2:C4=C2:C4,CELL("address",INDEX(D2:F2,MATCH(C2:C4,D2:F2,0))),))
i think its because the INDEX and MATCH doesn't update as it goes down, any idea how to fix this?
Sheets link: https://docs.google.com/spreadsheets/d/1oFTZHGd9PKpfZ9QXWvTshorEOGFxmD1cpeeQ9bIOYh8/edit?usp=sharing
You could use a query to get the minimum column matching the value in column C for each row in D to F:
=ArrayFormula(lambda(a,address(index(a,,1),index(a,,2)))
(query(split(flatten(if(C2:C="",,if(D2:F=C2:C,row(C2:C)&"|"&column(D2:F),))),"|"),"select Col1,min(Col2) where Col2 is not null group by Col1 label min(Col2) ''")))
Or alternatively you can use a formula similar to your original one with Byrow:
=ArrayFormula(if(C2:C="",,byrow(C2:F,lambda(r,CELL("address",INDEX(r,1+MATCH(index(r,,1),index(r,,2):index(r,,columns(r),0))))))))
I would like the option to toggle the display of compiled rank order responses in a grid between "response indicated" and "response indicated by rank number". I'm hoping for a formula solution rather than using Apps Script.
The included screenshot displays the current and desired outcome—with current as the example for "response indicated" (link to sheet below).
The grid pulls from responses on a separate sheet as shown in the included screenshot.
NOTE:
While the choice order on the input sheet is ordered 1-5, the display grid does not list the options in sort order.
There is a sort checkbox on map!C2 that informs whether the display grid uses the same order as input or sorts alphabetically.
The display grid uses separate formulas (B4 & C4—that do not reference one another) to populate.
The closest I've been able to generate is the first row toggling to the accurate ranking (using various combinations of QUERY, VLOOKUP, INDEX, MATCH, COLUMN)—but unable to generate an array output so that each row can create a specific response.
current C1 formula (uses named ranges):
=ArrayFormula(
IF(
REGEXMATCH(
IF(autoSort,
TRANSPOSE(QUERY(
TRANSPOSE(QUERY(
QUERY(inputTable,"where A is not null order by A",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),)),,
COLUMNS(QUERY(
QUERY(inputTable,"where A is not null order by A",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),)))),
TRANSPOSE(QUERY(
TRANSPOSE(QUERY(
QUERY(inputTable,"where A is not null",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),)),,
COLUMNS(QUERY(
QUERY(inputTable,"where A is not null",0),
"select "&ARRAYFORMULA(JOIN(",","Col"&SEQUENCE(1,5,2))),))))),
autoOptions),
CHAR(10003),))
link to example sheet: https://docs.google.com/spreadsheets/d/1eRaRf-0n-VQ2zljqUpk38sMrFlCh19JAcv7IFMeFMw0/edit?usp=sharing
just a MattKing's mod with a checkmark switch:
=INDEX(IFNA(VLOOKUP(B4:B&C3:K3,
SPLIT(FLATTEN(input!A2:A&input!B2:F&"|"&COLUMN(input!B1:F1)-1&"|"&CHAR(10003)), "|"),
IF(C1=TRUE, 3, 2), )))
This should do it:
=ARRAYFORMULA(IFERROR(VLOOKUP(B4:B&C3:K3,SPLIT(FLATTEN(input!A2:A&input!B2:F&"|"&COLUMN(input!B1:F1)-1),"|",0,0),2,0)))
I have a Spreadsheet (see link at the bottom of the page) that has 1 row and 3 columns.
I want to take the data contained and split it out, resulting in a row by row breakdown.
Is anyone aware of how this could be done using a formula? It would save me a bunch of time doing it manually!
DemoSheet - This shows what the input and the desired outputs are
EDIT:
The Input sheet shows the data as I have it, using metasyntactic variables as examples (real data will vary, but will always follow the same formatting).
For every email address in the email column, I need to do the following
Get the list of managers and members and have it output as per the Desired Output 1 sheet. So for each entry in ColA, a row entry for each of the data in B and C, as if they were concatenated, split by " | " and transposed vertically.
Repeat the above process but only for managers (as per the the Desired Output 2 sheet).
Is this what you need?
Output1:
=arrayformula({"Email","Members";
query(
array_constrain(
{
flatten(split(rept("|"&Input!A2:A,len(regexreplace(Input!B2:B&" | "&Input!C2:C,"[^\|]",))+1),"|")),
trim(flatten(split(Input!B2:B&"|"&Input!C2:C,"|")))
},
max(if(Input!B2:B<>"",len(regexreplace(Input!B2:B&" | "&Input!C2:C,"[^\|]",))+1,))*counta(Input!B2:B),2),
"where Col1 is not null",0)
})
Output2:
=arrayformula({"Email","Manager";
query(
array_constrain(
{
flatten(split(rept("|"&Input!A2:A,len(regexreplace(Input!B2:B,"[^\|]",))+1),"|")),
trim(flatten(split(Input!B2:B,"|")))
},
max(if(Input!B2:B<>"",len(regexreplace(Input!B2:B,"[^\|]",))+1,))*counta(Input!B2:B),2),
"where Col1 is not null",0)
})
You could optionally wrap unique() within the arrayformula if it is likely that you'll get duplicates in the dataset.
I have a simple sheet to try to track and format race results from a league that I've joined. For the most part I know how I want to do this but when I use a query it's dropping data in some situations and formatting it strangely in others.
It seems as if where there are more numbers in a column than text it drops all text entries.
In addition for some reason when I add a check row, if it's included in the query it pushes almost all the data into a single cell except for the check row.
Would someone mind having a look and trying to figure out why it's doing this. Link Below
On sheet RRL1 I have my compiled data on the left, my 'missing' data on the right and my weirdly formatted data below.
https://docs.google.com/spreadsheets/d/1c9xlQG06dQCrpMk3UMAX29oTlpRuhTfx6btbYTGmC8g/edit?usp=sharing
The query() formula will only support one data type per column — number, text, boolean or date. The type is determined by the majority of the values in the first few hundred rows. Values that are of another type will be returned as null, i.e., blank values.
=QUERY('Tournament Details'!D2:E22)
Use an { array expression } like this:
={ 'Tournament Details'!D2:E22 }
=TRANSPOSE(query('Tournament Details'!I3:I26))
Use this:
=transpose('Tournament Details'!I3:I26)
Use this pattern to replace "DNS" and "DNF" with nulls:
=arrayformula(
query(
{ 'RRL1'!A1:C, iferror(value('RRL1'!D1:D)) },
"select Col3, sum(Col4)
where Col3 is not null
group by Col3
label sum(Col4) 'Total AUS RRL1' ",
1
)
)
The "squished" values you mention come about because you are not specifying the headers parameter. The best practice is to always include it, like this:
=query('Tournament Details'!A2:E22,"select A where C != 'N/A'", 1)