Posted to microsoft.public.excel.misc
|
|
Add sequences of positive then negative numbers
Suppose your data is in A1 and below
In B1: =A1
In B2: =IF(SIGN(A1)=SIGN(A2),B1+A2,A2
Copy down as far as needed
In C1: =IF(SIGN(A1)=SIGN(A2),"",B1)
Copy down as far as needed
--
Kind regards,
Niek Otten
"judoist" wrote in
message ...
Niek Otten Wrote:
It seems to me there is a little error in your example: the list should
be
5,-9,10,-4,32,11 shouldn't it?
You got a VBA solution; fine. If you need something else, post again,
and
I'll give a worksheet formula solution
--
Kind regards,
Niek Otten
"judoist" wrote
in
message ...
I have a long list of random positive and negative numbers in column
A.
Id like to be able to add sequences of positive then negative
numbers
as they occur.
For example... in the list
5,-1,-5,-3,2,8,-1,-3,9,7,5,11,-5,6,5
.. i would add the positive numbers until the next number in the
list
was negative, then add the negative numbers till the next number was
positive, etc.
The answers for the above list would be 5, -9, 10 , -4, 21, -5, 11
Any ideas ?
--
judoist
------------------------------------------------------------------------
judoist's Profile:
http://www.excelforum.com/member.php...o&userid=10595
View this thread:
http://www.excelforum.com/showthread...hreadid=487976
Youre right, i was actually hoping for a worksheet example.
Any ideas ?
--
judoist
------------------------------------------------------------------------
judoist's Profile:
http://www.excelforum.com/member.php...o&userid=10595
View this thread: http://www.excelforum.com/showthread...hreadid=487976
|