如何获得最后3个结果的滚动总和,其中关键值在Google电子表格中的一个或另一列中
我的桌子看起来像这样:
主队 | 远方的家庭 | 索引索引 | 索引 | 房屋滚动得分 | 滚动滚动得分 | |
---|---|---|---|---|---|---|
费城 | 亚特兰大 | 1 | 0 | 0 | 0 | |
纽约 | 休斯顿 | 0 | 0 | 1 0 0 0 0 0 0 0 | 0 | |
费城 | 亚特兰大 | 0 | 0 0 | 0 0 | 0 | |
0 | 休斯敦 | 1 | 0 | 1 | 0 | |
纽约 | 0 | 0 | 1 | 0 | 1 | 1 |
洛杉矶 | 亚特兰大 | 1 | 0 | 0 | 0 | |
费城 | 亚特兰大 | 1 | 0 | 2 | 0 | |
纽约 | 费城 | 0 | 1 | 0 | 3 | |
圣安东尼 | 奥达拉斯 | 1 | 0 | 1 | 0 | |
费城 | 亚特兰大 | 1 | 0 | 3 | 0 | |
纽约 | 费城 | 0 | 1 | 0 | 3 | |
迈阿密 | 波士顿 | 1 | 0 | 1 | 0 | |
费城 | 亚特兰大 | 1 | 0 1 0 | 1 | 0 | |
纽约 | 休斯顿 | 0 | 1 | 0 | 1 |
我想为费城的最后3个成绩滚动额他们的所有比赛,因此,如果他们在家比赛,那么家庭索引编号应该计算,如果他们玩了,就应该数量计数。
结果应在另一列中进行,主队已经计算出他们的滚动总和,并且还为客队做同样的事情,直到该行(不包括该行)。这意味着在每个行中,查询都会寻找一个主队并计算滚动总和直到该行。 因此,就像示例中一样,您可以看到房屋滚动分数和外出滚动分数。如果您查看费城的得分,那是第一行的0,因为在费城的下一场比赛之前没有记录,这是1的总和,因为这是他们上一场比赛的总和,而在第10行中,还有Fame vs Atlanta的比赛,家庭的总和是3,这是费城的最后3行的总和,而无需计算这一行。
任何帮助我如何实现这一目标都非常感谢。
my table looks like this:
Home team | Away team | Home index | Away index | home rolling score | away rolling score | |
---|---|---|---|---|---|---|
Philadelphia | Atlanta | 1 | 0 | 0 | 0 | |
New York | Houston | 0 | 1 | 0 | 0 | |
Denver | Orlando | 1 | 0 | 0 | 0 | |
Philadelphia | Atlanta | 1 | 0 | 1 | 0 | |
New York | Houston | 0 | 1 | 0 | 1 | 1 |
Los Angeles | Atlanta | 1 | 0 | 0 | 0 | |
Philadelphia | Atlanta | 1 | 0 | 2 | 0 | |
New York | Philadelphia | 0 | 1 | 0 | 3 | |
San Antonio | Dallas | 1 | 0 | 1 | 0 | |
Philadelphia | Atlanta | 1 | 0 | 3 | 0 | |
New York | Philadelphia | 0 | 1 | 0 | 3 | |
Miami | Boston | 1 | 0 | 1 | 0 | |
Philadelphia | Atlanta | 1 | 0 | 1 | 0 | |
New York | Houston | 0 | 1 | 0 | 1 |
I would like to get a rolling sum for last 3 results for Philadelphia for example for all of their matches, so if they played at home then the home index number should count, if they played away, away index should count.
The result should come in another column where the home team has calculated their rolling sum and also do the same for away team until that row (not including that row). This means in every row the query will look for a home team and calculate the rolling sum until that row.
So as in the example you can see home rolling score and away rolling score. If you check the Philadelphia score, it's 0 in the first row because there are no records before then in the next game of Philadelphia it's 1 because that's the sum of their previous games and in row 10 where there is game Philadelphia vs Atlanta, the rolling sum for home is 3 which is the sum of last 3 rows for Philadelphia without counting that row.
Any help how can I achieve this is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
OverAl:
枢纽:
overal:
pivoted:
我相信这就是您要寻找的:
将公式放在单元格中
g2
和H2
分别将其复制到列下。我无法将它们作为整个列的阵列公式工作,但这可能是可能的。我将它们分开了,以便可以更好地理解它们,但是您也可以将它们结合在一起,将此
公式放入单元格
g2
并将其复制到列(autofillingH
)中。该公式找到了给定球队的最后3场比赛的滚得分。
I believe this is what you are looking for:
The formulas are placed in cells
G2
andH2
respectively, and are copied down the column. I was unable to get these to work as an array formula for the entire columns, but it may be possible.I separated them so they could be better understood, but you could also combine them like this
Placing this formula into cell
G2
and copying it down the column (autofillingH
).This formula finds the rolling score for the last 3 games of a given team.