ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to add consecutive positive numbers (https://www.excelbanter.com/excel-discussion-misc-queries/48173-how-add-consecutive-positive-numbers.html)

shreen_farhad

how to add consecutive positive numbers
 

Hi,

I have an urgent question:

say i have the following data:

a1 = -1, a2 = 0, a3 = -2, a4 = 1, a5 = 2, a6 = -1, a7 = -2, a8 = 5, a9
= -1, a10 = 1

I want to add the first consecutive positive numbers. How do I write a
formula for it?

What I want Excel to do is to go through this and add a4 and a5, that
is it. Those are the first cosecutive numbers that appear in the data
set.


--
shreen_farhad
------------------------------------------------------------------------
shreen_farhad's Profile: http://www.excelforum.com/member.php...o&userid=27736
View this thread: http://www.excelforum.com/showthread...hreadid=472445


Cutter


Try this in B2 and copy down:

=IF(AND(MAX(B$1:B1)=0,MIN(A1:A2)0,A2=A1+1),A1+A2, "")


--
Cutter
------------------------------------------------------------------------
Cutter's Profile: http://www.excelforum.com/member.php...fo&userid=9848
View this thread: http://www.excelforum.com/showthread...hreadid=472445



All times are GMT +1. The time now is 04:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com