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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
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
[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][td]
C​
[/td][td]
D​
[/td][td]
E​
[/td][td]
F​
[/td][td]
G​
[/td][/tr][tr][td]
1​
[/td][td]DATE[/td][td]PLAYER[/td][td]PTS[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
2​
[/td][td]
1/1/2017​
[/td][td]Player1[/td][td]
10​
[/td][td][/td][td][/td][td]player1[/td][td]
10​
[/td][/tr]
[tr][td]
3​
[/td][td]
2/1/2017​
[/td][td]Player2[/td][td]
15​
[/td][td][/td][td][/td][td]player2[/td][td]n/a[/td][/tr]
[tr][td]
4​
[/td][td]
2/1/2017​
[/td][td]Player1[/td][td]
18​
[/td][td][/td][td][/td][td]player3[/td][td]
25​
[/td][/tr]
[tr][td]
5​
[/td][td]
3/1/2017​
[/td][td]Player3[/td][td]
25​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
6​
[/td][td]
4/1/2017​
[/td][td]Player3[/td][td]
45​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
7​
[/td][td]
4/1/2017​
[/td][td]Player1[/td][td]
15​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
8​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
9​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
10​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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