Hi
I have a spreadsheet that contains football scores contained in a table. Columns A and B contain the home and away teams, and C to F show the number of goals scored in each half by both the home and away teams. A little difficult to explain in writing, but hopefully the below makes it a bit clearer!
The figures in columns K and L show:
K: The number of times the team in J2 have scored in the 2nd half, over the last 5 matches.
L: The number of goals the team in J2 have scored in the 2nd half, over the last 5 matches.
I have calculated the figures in columns K and L manually, but would like to know if there is a formula that would calculate these automatically. I assume an array formula is required. I have dug out an old thread from a few years back where I asked something similar, and have adapted that solution to calculate the figure for column L. Although this appears to calculate where both teams have scored in the 2nd half, rather than just the team in J2, I believe it might be a starting point:
{=SUM(((((Table4[[#Data],[Home Team]]=J2)+(Table4[[#Data],[Away Team]]=J2))*ROW(Table4[[#Data],[Home Team]]))>LARGE(((Table4[[#Data],[Home Team]]=J2)+(Table4[[#Data],[Away Team]]=J2))*ROW(Table4[[#Data],[Home Team]]),6))*((Table4[[#Data],[Home Team 2nd Half]]>0)*(Table4[[#Data],[Away Team 2nd Half]]>0)))}
I believe the first part in the non-bold text might be correct, but am having difficulty with the last section in bold. Any help would be greatly appreciated.
Thanks.
I have a spreadsheet that contains football scores contained in a table. Columns A and B contain the home and away teams, and C to F show the number of goals scored in each half by both the home and away teams. A little difficult to explain in writing, but hopefully the below makes it a bit clearer!
A | B | C | D | E | F | G | H | I | J | K | L | |||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Home Team | Away Team | Home Team 1stHalf | Away Team 1stHalf | Home Team 2nd Half | Away Team 2nd Half | Home 2nd Half Y/N | Away 2ndHalf Y/N | Team | Last 5 No of Games (2ndH) | Last 5 No of Goals (2ndH) | |||
2 | Bolton | Leicester | 1 | 0 | 2 | 1 | Y | Y | Bolton | 3 | 7 | |||
3 | Carlisle | Bolton | 1 | 1 | 0 | 1 | N | Y | ||||||
4 | Bolton | Huddersfield | 2 | 1 | 1 | 1 | Y | Y | ||||||
5 | Newcastle | Bolton | 0 | 1 | 0 | 0 | N | N | ||||||
6 | Torquay | Bolton | 1 | 1 | 0 | 2 | N | Y | ||||||
7 | Bolton | Grimsby | 1 | 0 | 0 | 0 | N | N | ||||||
8 | Bolton | Exeter | 1 | 2 | 3 | 1 | Y | Y | ||||||
9 | QPR | Bolton | 1 | 1 | 1 | 2 | Y | Y | ||||||
Sheet2 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
G2:H9 | G2 | =IF(E2>0,"Y","N") |
The figures in columns K and L show:
K: The number of times the team in J2 have scored in the 2nd half, over the last 5 matches.
L: The number of goals the team in J2 have scored in the 2nd half, over the last 5 matches.
I have calculated the figures in columns K and L manually, but would like to know if there is a formula that would calculate these automatically. I assume an array formula is required. I have dug out an old thread from a few years back where I asked something similar, and have adapted that solution to calculate the figure for column L. Although this appears to calculate where both teams have scored in the 2nd half, rather than just the team in J2, I believe it might be a starting point:
{=SUM(((((Table4[[#Data],[Home Team]]=J2)+(Table4[[#Data],[Away Team]]=J2))*ROW(Table4[[#Data],[Home Team]]))>LARGE(((Table4[[#Data],[Home Team]]=J2)+(Table4[[#Data],[Away Team]]=J2))*ROW(Table4[[#Data],[Home Team]]),6))*((Table4[[#Data],[Home Team 2nd Half]]>0)*(Table4[[#Data],[Away Team 2nd Half]]>0)))}
I believe the first part in the non-bold text might be correct, but am having difficulty with the last section in bold. Any help would be greatly appreciated.
Thanks.