View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default How to summarize the first 4 numbers greater than 0 from a list.

Make that...

=SUM(SUBTOTAL(9,OFFSET(A1:A100,SMALL(IF(A1:A1000, ROW(A1:A100)-ROW(A1)),R
OW(INDIRECT("1:"&MIN(4,COUNTIF(A1:A10,"0"))))),0, 1)))

....confirmed with CONTROL+SHIFT+ENTER.

In article ,
Domenic wrote:

Try...

=SUM(SUBTOTAL(9,OFFSET(A1:A100,SMALL(IF(A1:A1000, ROW(A1:A100)-ROW(A1)),{
1,2,3,4}),0,1)))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER. Adjust the range
accordingly.

Hope this helps!

In article ,
"Antonio" wrote:

I've a list of numbers, I need to summarize the first 4 greater than zero
cronologically eventhough they were in different places, and it could
happen
only three or less were in the whole list.
Ex.
2 0 0 0 8 -3 -5 0 4 0 0 0 3 0 0 0 0 7 8 9 4 5 1 2 -8 -7

Sum. 2 + 8 + 4 + 3 = 17

easy hu? Thanks