I have a column that lists bunch of numbers. How can I select the average of top 30% of the values in one column:
'Values'
10
9
8
7
6
5
4
3
2
1
so, the top 30% is '10, 9, 8' and the average is (10+9+8)/3 = 9
I have a column that lists bunch of numbers. How can I select the average of top 30% of the values in one column:
'Values'
10
9
8
7
6
5
4
3
2
1
so, the top 30% is '10, 9, 8' and the average is (10+9+8)/3 = 9
In any version of excel you can use either a SUMIF/COUNTIF along the same lines as Sean's suggestion, i.e.
=SUMIF(A1:A10,">"&PERCENTILE(A1:A10,0.7))/COUNTIF(A1:A10,">"&PERCENTILE(A1:A10,0.7))
or a shorter "array formula"
=AVERAGE(IF(A1:A10>PERCENTILE(A1:A10,0.7),A1:A10))
confirmed with CTRL+SHIFT+ENTER
These should all give identical results
If you are using excel 2007 or newer, =AVERAGEIF(A2:A10,">"&PERCENTILE(A2:A10,0.7))
Without using VBA:
Putting data into column A.
Create this intermediate column B:
B1=IF(RANK(A1,$A$1:$A$10)<=30*COUNT($A$1:$A$10)/(100), A1,0)
B2=IF(RANK(A2, ...
Then Average this column with:
=AVERAGEIF(B1:B10,">0")
For your given example you get 9.
You could also do this without formulas by including a column title and choosing:
Data > Filter > Number Filter > Top 10...(Top 30 Percent)
Highlight the column to see sum, average, count, max. (Right-click the status bar and select "average" if not displayed.)
If you want the result of the filtered average in a cell you can use =SUBTOTAL(1,A2:A11)