Google Sheet: How to reverse and transpose a row? - google-sheets

Need to reverse and transpose a row in google sheet
like below
Tried below formula but didn't reversed the order. Help me out!
=FILTER(TRANSPOSE(A1:E1),TRANSPOSE(A1:E1)<>"")

try:
=QUERY(SORT(FLATTEN(A1:1), FLATTEN(COLUMN(A1:1)), 0),
"where Col1 is not null")
or:
=INDEX(FLATTEN(VLOOKUP(ROW(A1), {ROW(A1), A1:1},
TRANSPOSE(SORT(SEQUENCE(COUNTA(A1:1))+1, 1, 0)), 0)))

=SORT(TRANSPOSE(A1:E1),SEQUENCE(COLUMNS(A1:E1)),)
SEQUENCE to create a array of sequential numbers
SORT to sort them in reverse
If you need to check for blanks, use QUERY to filter:
=QUERY(SORT(TRANSPOSE(A1:E1),SEQUENCE(COLUMNS(A1:E1)),),"where Col1 is not null",0)

Try
=query(sort(transpose({ARRAYFORMULA(column(A1:E1));A1:E1}),1,false),"select Col2")

Related

Trim rows and tranpose in Google Sheets

I'm trying to trim this rows horizontaly and then transpose the values in two columns with this formula:
=FILTER(7:8, TRIM(FLATTEN(QUERY(TRANSPOSE(7:8),,9^9)))<>"") But it looks like it don't do anything. Here is the data:
Help with this please
The following formula should produce the behaviour you want:
=QUERY(TRANSPOSE(7:8),"select * where Col1 is not null")
Can try FILTER() function.
=TRANSPOSE(FILTER(A7:I8,A7:I7<>""))
Also could use QUERY() like-
=QUERY(TRANSPOSE(A7:J8),"where Col1 is not null",0)

How to sum results obtained with VLOOKUP and IMPORTRANGE in Google Sheets?

I'm currently obtaining the result with the formula below, which was nicely provided by player0, but the challenge now is to obtain not only the figure found, but a sum, since the occurrences in the "database" may be multiple.
=Arrayformula(if(A9:A="";;IFNA(vlookup(A9:A&D9:D&"Expedição"&"Costura";
{IMPORTRANGE("fileId";"Produção!F2:F")&
IMPORTRANGE("fileId-1n3nQ";"Produção!H2:H")&
IMPORTRANGE("fileId-1n3nQ";"Produção!R2:R")&
IMPORTRANGE("fileId-1n3nQ";"Produção!B2:B")\
IMPORTRANGE("fileId-1n3nQ";"Produção!N2:N")};2;0))))
I have tried including sum in many places in the formula above, but with no success.
Here's a file with dummy data.
Thanks in advance.
use:
=ARRAYFORMULA(IF(A4:A="",,IFNA(VLOOKUP(A4:A&" "&C4:C&" Expedição Costura ",
QUERY(SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY({IMPORTRANGE(
"1gh5w0czg2JuoA3i5wPu8_eOpC4Q4TXIRhmUrg53nKMU", "Data Origin!A2:R")},
"select Col6,Col8,Col18,Col2,'×',Col14 where Col14>0 label '×'''", )),,9^9)), "×"),
"select Col1,sum(Col2) where Col2>0 group by Col1"), 2, 0))))

Google sheet arrayformula doesn't work with (Index(query(filter)

I would like to use the following formula in arrayformula so I do not need to pull down if new entries appear. Can you help please what am i missing? Thank you.
=Arrayformula(INDEX(Query(FILTER(B2:B, C2:C=I2:I), "select Col1 where Col1 is not null", false), 1, 1))
try:
=FILTER(B2:B, C2:C=I2:I, C2:C<>"")

sum google sheet and break line in different date

I want to sum in a column but this sum need to break if is a different day
here a small example google sheets
Found this but formula '=SUMIF(ARRAYFORMULA(MONTH(Sheet1!A2:A)),1,Sheet1!B2:B)'
Do You mean something like this ?
={"Total"; ArrayFormula(if(len(A2:A),if(match(A2:A, A2:A, 0)=row(A2:A)-1,sumif(A2:A,A2:A,B2:B),),))}
JPV, I'm wondering if your solution would only work if there were exactly two entries per date.
My suggestion (in C2):
=ArrayFormula(IF(INDIRECT("A2:A"&ROWS(A:A)-1)="","",IF(A3:A=INDIRECT("A2:A"&ROWS(A:A)-1),"",VLOOKUP(INDIRECT("A2:A"&ROWS(A:A)-1),QUERY(A2:B,"Select A, SUM(B) Where A Is Not Null Group By A Order By A Desc"),2,FALSE))))
try:
=ARRAYFORMULA(IF(COUNTIFS(A2:A, A2:A, ROW(A2:A), "<="&ROW(A2:A))=1,
IFNA(VLOOKUP(A2:A, QUERY(A2:B,
"select A,sum(B) where B is not null group by A"), 2, 0)), ))

Turning formula into ArrayFormula

I have this formula for counting matches in Contents!$B$2 in J4.
=ARRAYFORMULA(IF(NOT(REGEXMATCH(J4,
"\w")),0,SUM(COUNTIF(REGEXREPLACE(SPLIT(J4,","),"
[\s]",""),REGEXREPLACE(SPLIT(Contents!$B$2,","),"[\s]","")))))
The formula is in K4 but ideally, I want it to work right down J returning values to the relevant adjacent K. I tried this but it didn't work. Just filled the cell the formula was in
=ARRAYFORMULA(IF(NOT(REGEXMATCH(J4:J,
"\w")),0,SUM(COUNTIF(REGEXREPLACE(SPLIT(J4:J,","),"
[\s]",""),REGEXREPLACE(SPLIT(Contents!$B$2,","),"[\s]","")))))
I know I can just fill down but the issue is users inserting rows.
Thanks in advance for any assistance
=ARRAYFORMULA(IF(LEN(A2:A), IFERROR(VLOOKUP(A2:A,
QUERY(TRIM(TRANSPOSE(SPLIT(Contents!B1, ","))),
"select Col1,count(Col1) group by Col1", 0), 2, 0), 0), ))

Resources