View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Excel and consecutive number

If I understand what you want correctly, here is one method. Assuming you
have a list of numbers in column A with the first number in row 2:

Enter this formula in B2 and copy down through all rows of data:
=IF(A3=0,0,IF(B2=10,10,B2+1))
This formula counts consectuive non-zero numbers in column A.

Enter this formula in C11 and copy down through all rows of data:
=IF(B11=10,AVERAGE(LARGE(A2:A11,{1,2,3,4,5})),"")
This is an array formula which must be entered by pressing CTRL+Shift+Enter
and not just Enter. If you do it correctly then Excel will put curly brackets
around the formula {}. You can't type these yourself. If you edit the formula
you must enter it again with CTRL+Shift+Enter.
This formula averages the 5 largest in every group of 10 consectuive
non-zero numbers.

Enter this formula in D1 to get your final result:
=INDIRECT("C" & MATCH(1E+300,$C:$C))
This formula returns the last number in column C (the final average computed).

Hope this helps,

Hutch

"Shadowkiller361" wrote:

Is there a way to have excel locate a set number of consecutive non-zero
numbers and give me an average of those numbers?
trying to get around this problem:
5 largest consecutive non-zero numbers of the last 10 non-zero terms
hope there is some help out there for me