View Single Post
  #10   Report Post  
Harlan Grove
 
Posts: n/a
Default average numbers in sequence

bill gras wrote...
I have cells O1 to O300 numbers in random sequences of no more than 10
I need to average the 5 highest numbers in each sequence eg:

....

Enter the following *array* formula in cell P1.

P1:
=AVERAGE(LARGE(O1:INDEX(O2:O$65536,MATCH(TRUE,ISBL ANK(O2:O$65536),0)),
ROW(INDIRECT("1:"&MIN(5,MATCH(TRUE,ISBLANK(O2:O$65 536),0))))))

Then enter the following *array* formula in P2.

P2:
=IF(OR(ISNUMBER(O1),ISBLANK(O2)),"",
AVERAGE(LARGE(O2:INDEX(O3:O$65536,MATCH(TRUE,ISBLA NK(O3:O$65536),0)),
ROW(INDIRECT("1:"&MIN(5,MATCH(TRUE,ISBLANK(O3:O$65 536),0)))))))

Fill P2 down as far as needed.

No volatile function calls. Handles fewer than 5 values in each
sequence.