Calculate average of a column for dates only if they don't contain another value

slaytanic

New Member
Joined
Oct 5, 2017
Messages
3
Hi, what my confusing title is trying to ask is this: I want to calculate average points for a player when another player isn't playing. So in this list:

DATE PLAYER PTS
1-1-2017 Player1 10
2-1-2017 Player2 15
2-1-2017 Player1 18

What would be the formula to calculate avg points by player1 when player2 wasn't playing? Example is easy, it should be 10, but the original file has thousand of inputs - players, dates etc.

thank you
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Welcome to the Forum!

Perhaps like this:

D16: =IFERROR(SUMPRODUCT(C$2:C$11,--(B$2:B$11=B16),--ISERROR(MATCH(A$2:A$11,A$2:A$11*(B$2:B$11=C16),)))/SUMPRODUCT(--(B$2:B$11=B16),--ISERROR(MATCH(A$2:A$11,A$2:A$11*(B$2:B$11=C16),))),"n/a")

D1:I11 - shown just to illustrate the calculations


Excel 2010
ABCDEFGHI
1DATEPLAYERPTS123456
21 Jan 2017Player1101010
32 Jan 2017Player21515
42 Jan 2017Player11818
53 Jan 2017Player1131313
610 Jan 2017Player11111
710 Jan 2017Player31111
811 Jan 2017Player3121212
912 Jan 2017Player1202020
1013 Jan 2017Player21616
1113 Jan 2017Player31717
12
13Average13.5015.2516.0015.0014.5011.50
14
15ScenarioPlayerNot playerAverage
161Player1Player213.50
172Player1Player315.25
183Player2Player116.00
194Player2Player315.00
205Player3Player114.50
216Player3Player211.50
1
 
Last edited:
Upvote 0
Row\Col
A​
B​
C​
D​
E​
F​
G​
1​
DATEPLAYERPTS
2​
1/1/2017​
Player1
10​
player1
10​
3​
2/1/2017​
Player2
15​
player2n/a
4​
2/1/2017​
Player1
18​
player3
25​
5​
3/1/2017​
Player3
25​
6​
4/1/2017​
Player3
45​
7​
4/1/2017​
Player1
15​
8​
9​
10​

In G2 control+shift+enter, not just enter, and copy down:

=IFERROR(AVERAGE(IF(ISNA(MATCH(IF($B$2:$B$10=$F2,$A$2:$A$10),IF(1-($B$2:$B$10=$F2),$A$2:$A$10),0)),$C$2:$C$10)),"n/a")
 
Upvote 0
Welcome to the MrExcel board!

For the same sample data as Stephen, you could also try this. It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

I'm not sure how well either suggestion will go with thousands of rows, but give them a try.


Book1
ABCD
1DATEPLAYERPTS
21-Jan-17Player110
32-Jan-17Player215
42-Jan-17Player118
53-Jan-17Player113
610-Jan-17Player111
710-Jan-17Player311
811-Jan-17Player312
912-Jan-17Player120
1013-Jan-17Player216
1113-Jan-17Player317
12
13
14
15ScenarioPlayerNot playerAverage
161Player1Player213.5
172Player1Player315.25
183Player2Player116
194Player2Player315
205Player3Player114.5
216Player3Player211.5
Average
Cell Formulas
RangeFormula
D16{=AVERAGE(IF(B$2:B$11=B16,IF(COUNTIFS(A$2:A$11,A$2:A$11,B$2:B$11,C16)=0,C$2:C$11)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Thanks guys, it works! I didn't think something so messed up could be calculated but I guess everything can with a little logic!

cheers
 
Upvote 0

Forum statistics

Threads
1,215,613
Messages
6,125,834
Members
449,266
Latest member
davinroach

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