Here an example (I know there are differences in "," and ";" but this is only because I am using a german version of excel, all english commands like ROW etc. still apply)
[...]
Please try to post the sample of this exhibit in an Excel readable form along with the desired result.
Team Home | Team Away | Goal Difference |
A | G | 3 |
B | F | 3 |
C | A | 2 |
D | B | 0 |
E | C | 1 |
G | A | 0 |
A | D | 2 |
B | A | 1 |
C | G | 0 |
D | G | 4 |
E | F | 3 |
F | E | 0 |
G | C | 2 |
A | E | 2 |
B | E | 0 |
C | F | 0 |
D | C | 1 |
E | V | 2 |
F | A | 3 |
G | D | 0 |
A | G | 3 |
B | F | 3 |
C | A | 2 |
D | B | 0 |
E | C | 1 |
C | F | 0 |
C | A | 2 |
Team Home Team Away Goal Difference A G 3 B F 3 C A 2 D B 0 E C 1 G A 0 A D 2 B A 1 C G 0 D G 4 E F 3 F E 0 G C 2 A E 2 B E 0 C F 0 D C 1 E V 2 F A 3 G D 0 A G 3 B F 3 C A 2 D B 0 E C 1 C F 0 C A 2
<tbody>
</tbody>
And this is the code: =SUM(IF(ROW($C$2:$C$27)>=LARGE(IF($A$2:$A$27=$A$27;ROW($C$2:$C$27));MIN(6;COUNTIF($A$2:$A$27;$A$27)));IF($A$2:$A$27=$A$27;$C$2:$C$27)))
Again I had to replace the "," by the ";"
The formula retunrs the answer #NUM
Thank you for your help!
I get 4 as result, #NUM!.
This formula refers to A27 as a condition, a part of the data, which is not very wise.
Care to state what you want to calculate exactly?
Team Home | Team Away | Goal Difference | Date of Match | No of Match |
A | G | 3 | 27.01.2014 | 27 |
B | F | 3 | 26.01.2014 | 26 |
C | A | 2 | 25.01.2014 | 25 |
D | B | 0 | 24.01.2014 | 24 |
E | C | 1 | 23.01.2014 | 23 |
G | A | 0 | 22.01.2014 | 22 |
A | D | 2 | 21.01.2014 | 21 |
B | A | 1 | 20.01.2014 | 20 |
C | G | 0 | 19.01.2014 | 19 |
D | G | 4 | 18.01.2014 | 18 |
E | F | 3 | 17.01.2014 | 17 |
F | E | 0 | 16.01.2014 | 16 |
G | C | 2 | 15.01.2014 | 15 |
A | E | 2 | 14.01.2014 | 14 |
B | E | 0 | 13.01.2014 | 13 |
C | F | 0 | 12.01.2014 | 12 |
D | C | 1 | 11.01.2014 | 11 |
E | V | 2 | 10.01.2014 | 10 |
F | A | 3 | 09.01.2014 | 9 |
G | D | 0 | 08.01.2014 | 8 |
A | G | 3 | 07.01.2014 | 7 |
B | F | 3 | 06.01.2014 | 6 |
C | A | 2 | 05.01.2014 | 5 |
D | B | 0 | 04.01.2014 | 4 |
E | C | 1 | 03.01.2014 | 3 |
C | F | 0 | 02.01.2014 | 2 |
C | A | 2 | 01.01.2014 | 1 |
=SUM(IF(ROW($C$2:$C$27)>=LARGE(IF($A$2:$A$27=$A$27;ROW($C$2:$C$27));MIN(3;COUNTIF($A$2:$A$27;$A$27)));IF($A$2:$A$27=$A$27;$C$2:$C$27)))
Team Home Team Away Goal Difference Date of Match No of Match A G 3 27.01.2014 27 B F 3 26.01.2014 26 C A 2 25.01.2014 25 D B 0 24.01.2014 24 E C 1 23.01.2014 23 G A 0 22.01.2014 22 A D 2 21.01.2014 21 B A 1 20.01.2014 20 C G 0 19.01.2014 19 D G 4 18.01.2014 18 E F 3 17.01.2014 17 F E 0 16.01.2014 16 G C 2 15.01.2014 15 A E 2 14.01.2014 14 B E 0 13.01.2014 13 C F 0 12.01.2014 12 D C 1 11.01.2014 11 E V 2 10.01.2014 10 F A 3 09.01.2014 9 G D 0 08.01.2014 8 A G 3 07.01.2014 7 B F 3 06.01.2014 6 C A 2 05.01.2014 5 D B 0 04.01.2014 4 E C 1 03.01.2014 3 C F 0 02.01.2014 2 C A 2 01.01.2014 1
<tbody>
</tbody>
The formula should return the total goal differences for the latest three games of a certain home team for a certain date. In this case of the home team which is in A27 = Team called "C". In example, for the date in bolt letters, the row with date 25.01.2014. I want to add an extra column in which I will have a trend for the three latest home games of team C. Thus this extram column should add, and only add, the last three Goal differences for home matches of team C (i.e. 0+0+2 = 2). This extra column I want to add for any row, thus the trend will be different for each team, depending on the date (and thus the result of the three home games before this date).
I need this information for a regression analysis as I want to control for the quality/trend for a team.
I hope I could make myself clear. Thank you again for your patience and help!
1) I do not understand why you insist on C being in A27 instead of having this criterion outside of the data area, say in E1.
2) The same holds for 25.01.2015. Why not have this criterion date outside the data area, say in F1?
3) You say "for a certain date", i.e., 25.01.2015. Then you go to indicate the C dates 19.01.2015, 12.01.2015, and 05.01.2015. What is the relation of these dates with the criterion date of 25.01.2015?
1) I don't insist on this field. I just took it over from this thread, doesn't matter in which field it is. F1 is totally fine^^
2) Same here
3) The relation of these dates is that those dates represent the last three home games of Team C. They acctually do not really matter and should not be important for the formula. It was just a sidenote helping to understand what I am looking for. I highlightet the last three home games in red in the list above.
Row\Col | A | B | C | D | E | F | G |
1 | Team Home | Team Away | Goal Difference | Date of Match | Last | 3 | |
2 | A | G | 3 | 1/27/2014 | Team home | C | |
3 | B | F | 3 | 1/26/2014 | Total | 2 | |
4 | C | A | 2 | 1/25/2014 | |||
5 | D | B | 0 | 1/24/2014 | |||
6 | E | C | 1 | 1/23/2014 | |||
7 | G | A | 0 | 1/22/2014 | |||
8 | A | D | 2 | 1/21/2014 | |||
9 | B | A | 1 | 1/20/2014 | |||
10 | C | G | 0 | 1/19/2014 | |||
11 | D | G | 4 | 1/18/2014 | |||
12 | E | F | 3 | 1/17/2014 | |||
13 | F | E | 0 | 1/16/2014 | |||
14 | G | C | 2 | 1/15/2014 | |||
15 | A | E | 2 | 1/14/2014 | |||
16 | B | E | 0 | 1/13/2014 | |||
17 | C | F | 0 | 1/12/2014 | |||
18 | D | C | 1 | 1/11/2014 | |||
19 | E | V | 2 | 1/10/2014 | |||
20 | F | A | 3 | 1/9/2014 | |||
21 | G | D | 0 | 1/8/2014 | |||
22 | A | G | 3 | 1/7/2014 | |||
23 | B | F | 3 | 1/6/2014 | |||
24 | C | A | 2 | 1/5/2014 | |||
25 | D | B | 0 | 1/4/2014 | |||
26 | E | C | 1 | 1/3/2014 | |||
27 | C | F | 0 | 1/2/2014 |
Ok. Thanks.
~
Row\Col A B C D E F G 1Team Home Team Away Goal Difference Date of Match Last 3 2A G 3 1/27/2014Team home C 3B F 3 1/26/2014Total 2 4C A 2 1/25/2014 5D B 0 1/24/2014 6E C 1 1/23/2014 7G A 0 1/22/2014 8A D 2 1/21/2014 9B A 1 1/20/2014 10C G 0 1/19/2014 11D G 4 1/18/2014 12E F 3 1/17/2014 13F E 0 1/16/2014 14G C 2 1/15/2014 15A E 2 1/14/2014 16B E 0 1/13/2014 17C F 0 1/12/2014 18D C 1 1/11/2014 19E V 2 1/10/2014 20F A 3 1/9/2014 21G D 0 1/8/2014 22A G 3 1/7/2014 23B F 3 1/6/2014 24C A 2 1/5/2014 25D B 0 1/4/2014 26E C 1 1/3/2014 27C F 0 1/2/2014
<tbody>
</tbody>
G2, control+shift+enter, not just enter:
=SUM(IF(ROW($C$2:$C$27)>=LARGE(IF($A$2:$A$27=G$2,ROW($C$2:$C$27)),MIN(G$1,COUNTIFS($A$2:$A$27,G$2))),IF($A$2:$A$27=G$2,$C$2:$C$27)))<strike></strike>
This sums the goal differences associated with the last three games of C as team home. Is this what you are after?