Hi Munchy,
If you can use a helper column it might make it easier. For example:
Based on your example data in A5:E314, in F5 put the formula:
=COUNTIF($B$5:B5,B5)
Fill that formula down to F314. This will count the number of appearances of each team in the list (starting at 1 and incrementing up each time that team name appears again).
In G11 put the team you want to search for.
In G12 put the number of games you want to include in the sum.
In G13 use the formula shown below to get the correct sum:
=SUMPRODUCT(--(B5:B314=G11),--(F5:F314>=COUNTIF(B:B,G11)-(G12-1)),--(F5:F314<=COUNTIF(B:B,G11)),C5:C314)
Hopefully that will work for you. Obviously, G11 through G13 can be any cells you choose, just update the formula accordingly. Note that in SUMPRODUCT formulas the ranges used for comparison must be the same size, which is why I used B5:B314, F5:F314 and C5:C314. You also cannot use full columns in SUMPRODUCT formulas; although I did use full column references (B:B) in the COUNTIF formulas used for comparison, which is permitted.
Bookmarks