Fliped rows order from Importrange in google sheets - google-sheets

I have data to import from google sheet that are random and I need to get it in reversed row order using importrange function in another sheet?
The formula needs to be flexible as the row number in imported range may vary.
Can you help me to find solution? I was looking for Query parameters but I found only desc/asc parameter which is not helpful in this case. I can't make any "helping" column in this sheet.
Sample sheets:
importrange source sheet - https://docs.google.com/spreadsheets/d/1FbovD-T1ickPSat-RFsz_lk-HWZw6Ge-B87A4vhwLZc/edit#gid=0
importrange target sheet - https://docs.google.com/spreadsheets/d/1xXHea0yS9dEEBhYVongjDcg6jRptWFLjvL9C3T_hwMw/edit#gid=0

try:
=ARRAY_CONSTRAIN(SORT({IMPORTRANGE("id", "sheet1!A2:C7"),
SEQUENCE(ROWS(IMPORTRANGE("id", "sheet1!A2:C7")))}, 4, 0), 9^9, 3)
update:
=ARRAY_CONSTRAIN(QUERY(SORT({
IMPORTRANGE("1FbovD-T1ickPSat-RFsz_lk-HWZw6Ge-B87A4vhwLZc"; "Plan dnia!A2:M700")\ SEQUENCE(ROWS(
IMPORTRANGE("1FbovD-T1ickPSat-RFsz_lk-HWZw6Ge-B87A4vhwLZc"; "Plan dnia!A2:M700")))\TRIM(FLATTEN(QUERY(TRANSPOSE(
IMPORTRANGE("1FbovD-T1ickPSat-RFsz_lk-HWZw6Ge-B87A4vhwLZc"; "Plan dnia!A2:M700"));;9^9)))}; 14; 0);
"where Col15 is not null"; 0); 9^9; 13)

Try this
=SORT({ARRAYFORMULA(row(indirect("A1:A"&(counta(importrange("id","A1:A")))))),
query(importrange("id","A1:E"),"where Col1 is not null")},1,0)
if you begin at line 2
=SORT({ARRAYFORMULA(row(indirect("A2:A"&(1+counta(importrange("id","A2:A")))))),
query(importrange("id","A2:E"),"where Col1 is not null")},1,0)

Related

SUMPRODUCT has mismatched range error in Google Sheets

I have a Google Spreadsheet where I have maintained the results of some students. I need to display the number of students passed or failed per class from the filtered rows only. I am trying to obtain the same by using the following function:
=SUMPRODUCT(SUBTOTAL(3,OFFSET($B$2:$B$9,ROW($B$2:$B$9)-MIN(ROW($B$2:$B$9)),,1)),($C$2:$C$9=G$4)*($D$2:$D$9="PASS"))
The above function works fine if the spreadsheet is downloaded and opened in Excel. But in Google Spreadsheet, it returns the following error:
SUMPRODUCT has mismatched range sizes. Expected row count: 1, column count: 1. Actual row count: 8, column count: 1.
Can anyone help me with a fix?
Link to the Google Spreadsheet
Use the following formula in F4:
=QUERY(
{C2:D,ARRAYFORMULA(COUNTIFS(C2:C,C2:C,D2:D,D2:D))},
"select Col2, max(Col3) where Col3 > 0 group by Col2 pivot Col1 order by Col2 desc")
The resulting table will dynamically expand as you add more classes and test results to the data table.
Link to Google Sheet

Update certain cells from another Sheets according to a criteria in Google spreadsheets

I'm creating a Budget calculator spreadsheet in Google Drive, I'm trying to update cells from another Sheet with certain criteria:
This is Sheet1:
According to the date and category should update a cell from another Sheet in the same document, with the quantity.
This is Sheet2:
I'm not sure If I'm able to implement this flow in the same Google spreadsheets or if I should use Python instead. I tried everything and I'm stuck here. If someone could give me a hint about it I'll appreciate it a lot.
Here's the link to the spreadsheet: https://docs.google.com/spreadsheets/d/1BEtKJGVOdVF8PLxcR_96cPjE_4XH0QFbtV9dynroly0/edit?usp=sharing
try this cobra query in B13:
=INDEX(IFNA(VLOOKUP(A13:A21, QUERY({Sheet2!A3:D;
TO_DATE(SEQUENCE(12, 1, 2, 33)), 0/SEQUENCE(12, 3,,)},
"select Col2,sum(Col4)
where Col2 is not null
group by Col2
pivot month(Col1)-1"), SEQUENCE(1, 12, 2), )))

Get Binance Fees into Spreadsheets (Google Sheets)

I am trying to import a table from Binance fees (https://www.binance.com/en/fee/depositFee) to Google Sheets (buy i am trying into MS Excel).
When i get data, i dont know how split files for each network type.
Now, i have data like this:
=IMPORTHTML("https://www.binance.com/en/fee/depositFee"; "table"; 0)
Thanks!!!
One solution is, after importing data as you did, is to split each line as following
=iferror(transpose(flatten(arrayformula(transpose(split(transpose(C3:F3),char(10)))))),"")
You will get multiple blocks of 4 columns. And finally you can group data like this way, assuming there is a max of 4 blocks :
=query({query( 'raw data'!A3:V,"select A,B,G,H,I,J");query('raw data'!A3:V,"select A,B,K,L,M,N");query('raw data'!A3:V,"select A,B,O,P,Q,R");query('raw data'!A3:V,"select A,B,S,T,U,V")},"select * where Col3<>'' order by Col1")
https://docs.google.com/spreadsheets/d/1JCjJywK9qPprynX2byvAnU7jS4S9cAYmHAfLcuyW3oQ/edit?usp=sharing
I can offer a solution* with a formula in one cell that works over your importrange data (shown in cell H1 below):
=arrayformula(
{query(IFERROR(array_constrain(
{"Coin/Token","Full Name","Network","Minimum Withdrawal","Deposit fee","Withdrawal Fee";
flatten(split(rept("|"&A3:A,LEN(regexreplace($C3:$C,"[^\n]",""))+1),"|"))
,flatten(split(rept("|"&B3:B,LEN(regexreplace($C3:$C,"[^\n]",""))+1),"|"))
,flatten(split(C3:C,CHAR(10)))
,flatten(split(D3:D,CHAR(10)))
,flatten(split(E3:E,CHAR(10)))
,flatten(split(F3:F,CHAR(10)))
},
max(IF(A3:A<>"",LEN(regexreplace($C3:$C,"[^\n]",""))+1,))*COUNTA(A3:A),
6)
,),"where Col1 is not null",0)
})
It expands the cells in columns C,D,E and F where there are multiple items in C. It also repeats values from columns A and B.
Columns D and F correctly convert to numbers.
Formula updated with Mike Steelson enhancements and player0 LEN/REGEXREPLACE.
all you need is:
=INDEX(TRIM(TRANSPOSE(SPLIT(FLATTEN(QUERY({REPT(ARRAY_CONSTRAIN(
IMPORTHTML("https://www.binance.com/en/fee/depositFee", "table", 1), 9^9, 2)&
"×", 1+LEN(REGEXREPLACE(INDEX(""&
IMPORTHTML("https://www.binance.com/en/fee/depositFee", "table", 1),, 3),
"[^\n]+", ))), REGEXREPLACE(QUERY(
IMPORTHTML("https://www.binance.com/en/fee/depositFee", "table", 1)&
"×", "select Col3,Col4,Col5,Col6", 1), "\n", "×")},,9^9)), "×"))))

How to fetch specific data for specific word/phrase into a single cell in Google sheets

I have data in columns A:F and unique entries in column H. I'm using the data in column H to filter it's data from the first two columns and return data in the 5th and 6th columns (E and F).
I have tried and got myself a working formula but it's incomplete to get me the data I need. The formula is:
=IFERROR(QUERY(INDEX(SORT(FILTER({E2:E, ROW(A2:A)}, (A2:A=H2)+(B2:B=H2)), 2, 0),,1),,100000))
*The query function is to allow more than 50000 characters in that happens.
Please check out my data in this google sheets file to better understand.
https://docs.google.com/spreadsheets/d/1hGy_bIAzKj8Qq0l2BGu2ya6mrYaD7pmixPQISzunHrI/edit?usp=sharing
delete E:F and use this in E2:
=ARRAYFORMULA(IF(A2:A="",,"<td class="""&
IF(C2:C>D2:D, {"win", "loss"},
IF(C2:C<D2:D, {"loss", "win"}, "draw"))&"""></td>"))
then use this and drag down:
=ARRAYFORMULA(QUERY(INDEX(QUERY(SORT({SPLIT(QUERY(
FLATTEN(IF($A$2:$B="",,$A$2:$B&"×"&$E$2:$F)),
"where Col1 is not null"), "×"), SEQUENCE(COUNTA($A$2:$B))}, 3, 0),
"where Col1 = '"&H2&"'"),,2),,9^9))

Is there a reason why my ArrayFormula is not working in the other cells of my column?

In a Google sheet with form responses, I made an additional column where I want to look up from each submission if the value left of my new column already occurs in a range on another sheet.
So this is going to be a Vlookup formula finally.
Unfortunately, I didn't make it to the Vlookup part yet because the ArrayFormula part is not working.
I started off by looking to the cell value at the left with this formula, which worked, but the ArrayFormula part of it DOESN'T work.
=ArrayFormula(indirect(ADDRESS(ROW(), COLUMN()-1)))
I know that some functions don't work very well with ArrayFormula,
But I don't see any reason here this should not work because it's only looking to its row and its column.
I hope the image shows the problem well enough
If you just want to repeat the values from the previous column (let's say column A, starting in row 2), you can try in column B (also in row 2)
=Arrayformula(if(len(A2:A), A2:A,))
Change range to suit. See if that helps?
UPDATE: To repeat the previous column (anywhere you input the formula) try (in row 2)
=offset(A1, 1, column()-2, rows(A1:A))
To 'limit' the output you can use any number instead of rows(A1:A) or replace it with COUNTA(A1:A)...
you can do something like this, which will search for specific header across entire sheet and then return values of that column:
=QUERY({INDIRECT("Sheet1!"&
ADDRESS(1, MATCH("job ID", Sheet1!1:1, 0), 4)&":"&
ADDRESS(1000000, MATCH("job ID", Sheet1!1:1, 0), 4))},
"select * where not Col1 matches 'job ID' and Col1 is not NULL", 0)
without sheet name:
=QUERY({INDIRECT(
ADDRESS(1, MATCH("job ID", 1:1, 0), 4)&":"&
ADDRESS(1000000, MATCH("job ID", 1:1, 0), 4))},
"select * where not Col1 matches 'job ID' and Col1 is not NULL", 0)

Resources