View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Need help with a formula with zero

You post is not clear if A7 will always contain the last number in the
column or if that was simply used for example purposes. Here is a formula
that doesn't care...

=SUM(A:A)-SUMPRODUCT(A1:A999*(IF(ISNA(MATCH(0,A:A,0)),0,MATC H(0,A:A,0))ROW(A1:A999)))

As long as there are less than 1000 values in Column A (increase the 999 if
you need to handle more values), it will return the sum from the **first**
zero it sees up until the last number in the column.

Rick


"Curtis" wrote in message
...
If I had column A with numbers; like if A1=15; A2=10; A3=12; A4=5; A5=8;
A6=10; A7=10 when I sum all this together it total to B1=70. Question is
if
A6=0 and rest are the same then b1=10, what I trying to do is if there any
zero then it only add after zero not before. If A5=0 then A6 and A7 adds
to
20, any help on this?