Average of last 5 values in row if condition met??

rhigley0126

New Member
Joined
Jul 5, 2014
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I'm working on an excel file for tracking/analyzing fantasy baseball statistics. Each player is on an individual row and the columns contain 14 different statistics for every day of the season, i.e. columns E through R contain stats for March 31st, columns S through AF contain stats for April 1st and so on. One of the columns for each day contains a "1" if the player started that day and a "0" if they did not. The last column for each day contains the total number of fantasy points they scored for that day.

I'm struggling to come up with a formula that will return the average total fantasy points a player scored in the last five games they started. So the formula would first have to check if the "Start" column for the most recent date contains a "1" and if so, return the average of the value in the corresponding "Total Points" column for that day along with the next four total points from days where the player started.

Not even sure where to start with this one - any help will be greatly appreciated!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Below is the last two days worth of data for 20 different players. I have also shared an example of the excel data here:

http://www.filedropper.com/fantasybaseballexample070514

As you can see, yesterday the last player on the list did not start, yet still scored points (walked and scored a run after pinch-hitting later in game) but I don't want to count that in the last 5 games average. In the file from the link above, you can see that his total points average would actually be 5.00 (counting 6/28, 6/29, 6/30, 7/2 and 7/3 - excluding 7/4 because the "Strt"=0 and excluding 7/1 because his team was off that day, hence the blanks).

2e17t3r.jpg
 
Upvote 0
Something like this should be a good start.
=AVERAGE(IF(EC5=1,ED5,),IF(DO5=1,DP5,),IF(DA5=1,DB5,),IF(CM5=1,CN5,),IF(BY5=1,BZ5,))
You will need to manually input it into each cell that requires an average and adjust each cell affected. It'll take some time to make it accurate.
 
Upvote 0
I was working off of something similar to that at one point but I couldn't figure out how to get it to stop adding more numbers to average once it had reached five.
 
Upvote 0
Okay, I've given up on trying to average the last 5 games in which a player started. I'm sure it's possible with some sort of array formula or something, but I've been stuck on it for two days now and at this point it's not worth the hassle.

Now I'm just trying to average the Total Points from the last 5 days regardless of whether or not the player started. In cell C3 is today's date, so I'm thinking I can do some sort of AVERAGEIF formula that averages the Total Points if Today's Date - Game Date <=5. However the AVERAGEIF would also need to ensure it's only averaging the values in the "Tot" column for those dates. Below is a link to an example of what I'm working with - I'm open to any suggestions on format change or anything that will make it easier to come up with these averages. Thanks in advance for any help!​

http://www.filedropper.com/dailyfantasybaseballexample070514
 
Upvote 0
rhigley0126,


Maybe try this....

Excel 2007
EAEBECEDEEEFEGEHEIEJEKELEMENEOEPEQERESETEUEVEWEXEY
304/07/2014Last 5 Games Average
4H/AOppStrt1B2B3BHRRBIRBBHbPSBCSTot1B2B3BHRRBIRBBHbPSBCSTot
5Hsea1.000.000.000.0010.004.002.000.000.000.000.0016.009.20
6Achw1.000.000.000.000.000.000.000.000.000.000.000.005.60
7Hmia1.003.000.000.000.000.000.000.000.000.000.003.004.00
80.00
90.00
100.00
11Hphi0.000.000.000.000.000.000.000.000.000.000.000.006.20
12Anym1.009.000.000.000.000.002.000.000.005.000.0016.006.40
130.00
14Hnyy1.000.000.008.000.002.002.002.002.005.000.0021.007.40
15Hlad1.003.000.000.000.000.000.000.000.000.000.003.000.00
160.00
17Asdg1.000.005.000.000.000.000.000.000.000.000.005.000.00
18Apit1.000.000.000.000.000.000.002.000.000.000.002.004.80
19Htam1.000.000.000.000.000.000.000.000.000.000.000.005.60
20Hhou1.000.000.000.000.000.000.000.000.000.000.000.002.00
210.00
22Hlad1.000.000.000.000.000.000.000.000.000.000.000.000.00
23Awas1.006.000.000.000.000.002.000.000.000.000.008.007.20
24Anym0.000.000.000.000.000.002.002.000.000.000.004.005.00
Player Data
Cell Formulas
RangeFormula
EY5{=IF(SUM(($G5:$EC5=1)*(MOD(COLUMN($G5:$EC5)-7,14)=0))>4,SUM(($G5:$EC5=1)*(MOD(COLUMN($G5:$EC5)-7,14)=0)*(IF(ISNUMBER($R5:$EN5),$R5:$EN5,0))*(COLUMN($R5:$EN5)>LARGE((MOD(COLUMN($R5:$EN5)-18,14)=0)*($G5:$EC5=1)*COLUMN($G5:$EC5),6)+11))/5,0)}
Press CTRL+SHIFT+ENTER to enter array formulas.


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,790
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top