Saturday, January 11, 2014

How to calculate 95th percentile of values with grouping variable in Excel

Sample data:
     A            B           C          D
1 Watershed   WQ
2 50500101    62.370661    50500101     {formula here}
3 50500101    65.505046
4 50500101    58.741477
5 50500105    71.220034
6 50500105    57.917249
 
Excel formula in D2 :
 
{=PERCENTILE(IF($A2:$A6=C2, $B$2:$B$6), 0.95)} 

Also, be sure to enter the formula as an array formula. 
Do so by pressing Ctrl+Shift+Enter when entering the formula. 
 
http://stackoverflow.com/questions/5473537/how-to-calculate-95th-percentile-of-values-with-grouping-variable-in-r-or-excel