When I use the format that I left below, returns in error, I know that something is missing adjusting in relation to WHERE AND... But I could not fit to supply the error.
I would like some help knowing what I missed.
"select Col1,Col2,Col3 where Col1 is not null Order by Col1, Col2 AND Col1 > date'"&TEXT(today()-1,"yyyy/mm/dd")&"'"
The date and time for Col1 and Col2 are like this:
With this formula, I hope I can filter the imported data only for those that have the date of the current day or tomorrow and that today's games are higher than the current time.
Link to spreadsheet:
https://docs.google.com/spreadsheets/d/15T4UPVtEHv43DLomKcTmdaPuGWMsBUoO7bLvlOhab4k/edit?usp=sharing
Formula set in Página1 G2
it may look like you can combine parameters as you like but there is a specific order that needs to be followed:
respectively joining operator like and needs to be proceeded by parent parameter where:
Try:
"select Col1, Col2, Col3 where Col1 >='"&TEXT(TODAY()-1,"yyyy-mm-dd")&"' and Col1 is not null Order by Col1, Col2"
This returns 78 records
Related
I have date in one column and data in another from jan 2017 to Dec 2022.
I want to find sum of data month wise.
attaching file. Currently doing it manually. Any work around, array or something. Help.
You can try with a QUERY like this:
=QUERY({INDEX(EOMONTH(A:A,0)),C:C},"SELECT Col1,Sum(Col2) where Col2 is not null group by Col1 format Col1 'MMM-YYYY'",1)
within sheets you can try:
=QUERY({INDEX(IF(LEN(A9:A),EOMONTH(A9:A,),)),C9:C},"SELECT Col1, SUM(Col2) Where Col1 IS NOT NULL GROUP BY Col1 LABEL SUM(Col2) '' FORMAT Col1 'MMM YY'")
I'm not too savvy with programming, so bear with me. The data is of the players' names and fighters in a fighting game, with the table as below:
I'm making a leaderboard where it will show which fighter each player uses most. I found a formula that shows which fighter is used the most in general using the following formula:
=index(query({E2:E,G2:G},
"select Col1,count(Col1)
group by Col1
order by count(Col1) desc"), 2, 1)
The problem is, I don't understand how to make a formula that checks the player's name before returning the most used fighter from two columns. What I'm after is a result like so:
Thanks in advance!
Formula
=ArrayFormula(
{QUERY(QUERY({SPLIT("Wins"&"|"&UNIQUE({D2:D;F2:F}&"|"&"."),"|");SPLIT("Loss"&"|"&UNIQUE({D2:D;F2:F}&"|"&"."),"|");
SPLIT("Wins"&"|"&FILTER(D2:D&"|"&E2:E,D2:D<>""),"|");
SPLIT("Loss"&"|"&FILTER(F2:F&"|"&G2:G,F2:F<>""),"|")},
"select Col2,count(Col3)-1 where Col2!='.' group by Col2 pivot Col1"),"select Col1,Col3,Col2,Col3/Col2,Col3/(Col3+Col2) order by Col3 desc label Col1 'Name',Col2 'Loss',Col3 'Wins',Col3/Col2 'W/L',Col3/(Col3+Col2) 'Win Rate %' format Col3/Col2 '0.0',Col3/(Col3+Col2) '#.0%'"),
VLOOKUP(INDEX(QUERY({D2:D},"select Col1,count(Col1) where Col1!='' group by Col1 order by count(Col1) desc label Col1 'Name'"),0,1),QUERY({D2:E;F2:G},"select Col1,Col2,count(Col2) group by Col1,Col2 order by Count(Col2) desc label Col1 'Name',Col2 'Most Used Character'"),2,0)})
Note:
column Wins/Loss cannot be calculated when Loss=0 .
Hope you're okay with that
I'm looking for a formula, =query possibly, that will turn this:
Into this:
I used the following formula successfully to get the AFTER picture, but I can't get the counts. I tried using concatenate but there isn't a way to do that to each item in the array. Maybe there is a way to do this using a query?
=transpose(split(join(",",unique(C1:C98)),","))
And here's my flavour of it, which also needs to be dragged to the right, to fill the other columns:
=ARRAYFORMULA(QUERY(
{UNIQUE(A$2:A) & " - " & COUNTIF(A$2:A,UNIQUE(A$2:A))},
"where Col1<>' - 0'",0))
Yes, you can use query to get the unique values and counts then join the two columns
=ArrayFormula(index(query(A2:A,"select A,count(A) where A is not null group by A label count(A) ''"),0,1)&"-"&index(query(A2:A,"select A,count(A) where A is not null group by A label count(A) ''"),0,2))
Apologies, in order to drag it across you would have to put:
=ArrayFormula(index(query({A2:A},"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1) ''"),0,1)
&"-"&index(query({A2:A},"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1) ''"),0,2))
Try the following in cell A2 and drag to the right.
=ARRAY_CONSTRAIN(ArrayFormula(IFERROR(CONCAT(UNIQUE(A2:A99)&" - ",
ArrayFormula(COUNTIFS(A2:A99,UNIQUE(A2:A99)))))),COUNTUNIQUE(A2:A99),1)
Also using a query
=ArrayFormula(index(query({A2:A},"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1) ''"),0,1)&"-"&
index(query({A2:A},"select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1) ''"),0,2))
The only difference is that using the first formula you maintain the names within the order they appear, while using the query they get sorted alphabetically.
Functions used:
ARRAY_CONSTRAIN
ArrayFormula
IFERROR
CONCAT
UNIQUE
COUNTIFS
COUNTUNIQUE
When I import data, it comes in this format (image 1), with blank spaces. I would like to know if there is any way to adjust so that these blanks disappear, the two models expected (image 2 and 3) if there was any way to reach them would be important to me.
Remembering that all dates have / and all times have :
I tried to filter from QUERY, but when trying to "Select Col1, Col2, Col4 Where Col2 is not null" the dates disappear and only the times remain, I tried via REGEXMATCH to separate the dates from the times using / and : but also I was not successful.
I also tried it via IMPORTXML, but some data ends up not being imported correctly on some pages of the site, for IMPORTHTML these errors do not happen. The XML's I used were:
"//tr[#class='no-date-repetition-new' and ..//td[#class='team team-a']] | //tr[#class='no-date-repetition-new live-now' and ..//td[#class='team team-a']]"
"//td[#class='team team-a']/a | //td[#class='team team-a strong']/a"
The current formula is as follows:
=IMPORTHTML("https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/","table",1)
IMPORTHTML Original:
Expected formats:
---
Rather than filtering what you need is to restructure the imported data.
Anyway, I think that the easier solution to get the final result is to use multiple IMPORTXML formulas.
URL
A1: https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/
Headers
A2: //table[contains(#class,'matches')]/thead/tr/th
Day
A3: //td[contains(#class,'date')]/parent::tr
Teams and Score
A4: //td[contains(#class,'team-a')]/parent::tr
A6: =transpose(IMPORTXML($A$1,A2))
A7: =IMPORTXML($A$1,A3)
B7: =IMPORTXML(A1,A4)
You might want to replace the formula on A6 by static values in order to place them properly.
You can join 2 queries together (one next to the other) in a single formula, to get your results
={QUERY(IMPORTHTML("https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/","table",1),
"select Col1 where Col2 is null and not Col1 contains '*'",1),
QUERY(IMPORTHTML("https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/","table",1),
"select Col1, Col2, Col3, Col4 where Col2 is not null label Col1 'Time'",1)}
How the formula works:
As you notice the data part of both queries is the same in both of them. What is actually different is "what we ask for from the query"
In the first one we use "select Col1 where Col2 is null and not Col1 contains '*'"
In the second one "select Col1, Col2, Col3, Col4 where Col2 is not null label Col1 'Time'"
We create an array by joining them together as in ={1stQUERY,2ndQUERY}
I'm making a bonus model for work. There are a lot of article numbers that the sheet has to check.
Right now I'm using this:
=SUMIFS(Data!$K$2:$K;Data!$I$2:$I;AA$2;Data!$G$2:$G;$A14)+
SUMIFS(Data!$K$2:$K;Data!$I$2:$I;AB$2;Data!$G$2:$G;$A14)+
SUMIFS(Data!$K$2:$K;Data!$I$2:$I;AC$2;Data!$G$2:$G;$A14)+
SUMIFS(Data!$K$2:$K;Data!$I$2:$I;AD$2;Data!$G$2:$G;$A14)
etc
etc
Is there a way to combine everything in one Formula? AA2:AD2 doesn't work...
I hope I'm explaining it right :)
https://docs.google.com/spreadsheets/d/e/2PACX-1vRO-4tOpgZD97cvDEAjoCz-xK-7YhrjpzRlUBplpXOrwgssE2VYjuzdX3oBZdbNVk924J6La-Vy-52_/pubhtml
I'm confused with how your data works a bit. But am I right that you want to check for each salesperson if they sold any of the article numbers, and if that's the case sum the column C?
Like so?
Formula I used translates to:
{=SUMPRODUCT(($A$2:$A$107=F2)*($B$2:$B$107=TRANSPOSE($E$2:$E$15))*($C$2:$C$107))}
And needs to be confirmerd through CtrlShiftEnter
How about :
=SUMIFS(Data!$K$2:$K;Data!$I$2:$I;AA$2;Data!$I$2:$I;AB$2;Data!$I$2:$I;AC$2;Data!$I$2:$I;AD$2;Data!$G$2:$G;$A14)
Still trying to find a way to combine criteria...
Well, played and depending what your data is, and if you can control it then something like this may help:
N9:
=QUERY({A3:C}, "select Col1,sum(Col3)
where Col1 is not null
group by Col1
label sum(Col3)''")
H9:
=TRANSPOSE(QUERY({A3:C}, "select Col1,sum(Col3)
where Col1 is not null
group by Col1
pivot Col2
label sum(Col3)''"))
E9:
=QUERY({A3:C}, "select Col2,sum(Col3)
where Col2 is not null
group by Col2
label sum(Col3)''")
E3:
=QUERY({A3:C}, "select Col1,sum(Col3)
where Col1 is not null
group by Col1
pivot Col2
label sum(Col3)''")