Google Sheets - Find first occurrence of two unique values combined - google-sheets

I am trying to execute as shown in the following google sheet link. I need to locate the first occurrence of two unique values in column H and I combined and input the Ratings as in the table.
Sample data
My efforts have been displayed in the sheet.

use:
=ARRAYFORMULA(IF(COUNTIFS(H2:H&I2:I, H2:H&I2:I, ROW(A2:A), "<="&ROW(A2:A))=1,
IFNA(VLOOKUP(H2:H&I2:I, SPLIT(FLATTEN(A2:A&{B1, D1}&"×"&{C2:C, E2:E}), "×"), 2, )), ))

Related

How do I find a row, find the highest value in that row, and return that column header?

In the below spreadsheet, I am trying to find the bar with the highest sales per show. So I want the formula in cell B2 on the 'FRONT SHEET' to look at the 'BAR SALES' sheet and find the specific show, find the highest sales in that row, and then pull the bar name.
I am currently using this formula which works; however, the formula is specific to this show. I want the formula to be broader and be able to search for the show in the 'BAR SALES' sheet.
=INDEX('BAR SALES'!$B$1:$F$1,MATCH(MAX('BAR SALES'!B2:F2,'BAR SALES'!B2:F2),'BAR SALES'!B2:F2,0))
This is a dummy spreadsheet but has the gist. My actual sheet is a lot bigger so I want to be able to search a long list of shows for this information without specifically tailoring the formula to each show in that list. Can I add a vlookup in this formula somehow??
[https://docs.google.com/spreadsheets/d/1dcjjQyZj9ANUTyTMloiY2CX94nBSYLt5hCiSWzY3tBk/edit#gid=1376876918][1]
use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, SORTN(SORT(SPLIT(
FLATTEN('BAR SALES'!A2:A&"×"&'BAR SALES'!B1:F1&"×"&'BAR SALES'!B2:F),
"×"), 3, 0), 9^9, 2, 1, 1), 2, 0)))
This is a slightly longer version of #player0's. Either will return the same response. They both do a FLATTEN and then a SPLIT to generate three columns. Test each out with your data to see if either is faster. They should be roughly the same, but its worth testing.
=ARRAYFORMULA(
IF(ISBLANK(A2:A),,
IFERROR(
VLOOKUP(
A2:A,
QUERY(
SPLIT(
FLATTEN(
IF(ISBLANK('BAR SALES'!A2:A),,
'BAR SALES'!A2:A&"|"&'BAR SALES'!B1:F1&"|"&'BAR SALES'!B2:F)),
"|"),
"where Col3 is not null
order by Col3 desc"),
2,FALSE))))

Sum Up Values from the Same Date In Google Sheets

I have a sheet that I am using to track wordcount over multiple writing projects. I'd like to have it automatically add up the words I've written that day. I write in multiple sessions, and each session is its own row on the sheet.
I continue to add onto the sheet during the month, so using DATE won't work unless I want to manually change the formula every time a new day starts. I'd really appreciate whatever help could be given.
Here is the link to the sheet--this one is a copy, so feel free to poke around as needed and don't worry about messing it up :) https://docs.google.com/spreadsheets/d/1mNrJzSDpfTRuvZSRpt7BQn0HfA2mdhZzTym2DqNlXZU/edit?usp=sharing
delete all in column I and use in row 1:
={"Daily Total"; INDEX(IFNA(VLOOKUP(IF(COUNTIFS(A2:A, A2:A,
ROW(A2:A), "<="&ROW(A2:A))=1, A2:A, ), QUERY({A2:A, H2:H},
"select Col1,sum(Col2) where Col2 is not null group by Col1"), 2, 0)))}

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))

Google Sheets Column function to get Average of all the columns in a range to the right using current row

I'm not sure why I can't find examples of this.
But I want my column E to have an average of all the columns to the right. In single example it's:
=AVERAGE(F2:O2)
Now I try to do this for the whole column:
=ArrayFormula(IF(ROW(E:E)=1,"Aggregate",AVERAGE(F:O)))
The problem is it doesn't do it per row, it just does the whole array. Maybe i don't want to use ArrayFormula
I should also put a IF(ISBLANK(F (Row())), "" So I don't calculate blank rows.
How do I put dynamic row on this?
try:
=ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(F2:O),
"select "&TEXTJOIN(",", 1,
IF(TRIM(TRANSPOSE(QUERY(TRANSPOSE(F2:O),,99^99)))<>"",
"avg(Col"&ROW(F2:F)-ROW(F2)+1&")", ))&"")),
"select Col2"))

Resources