Formula for Sum of Max Consecutive Negative Values D5:D29

thankyou

Board Regular
Joined
Aug 13, 2008
Messages
189
Hi. I've done some research here but I'm afraid I haven't yet found the answer. I'm looking for a sum formula that will do these things:

1. SUM the largest streak of negative numbers in that range.(aka "max drawdown")
2. SUMthe largest streak of positive numbers in that range.(aka "max runup")

and then these 2 simple Counts:

1) # of consecutive cells bearing the longest streak of neg #s
2) # of consecutive cells bearing the longest streak of positive #s

No VBA or arrays if you don't mind. Just a formula like:

=SUM (etc)

I respect your time and experience.

thankyou
 
Domenic, I see your post just came in and sorry I missed it when I posted just now above. I really appreciate your contributing here! Um, I have this question: does "native" mean no VBA, but we basically build on the awesome contribution from Aladin etc? Kind regards.

Yes, that's right, no VBA...
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Another possible solution without VBA

Same formulas as Aladin in C2 and C3

D2
=MIN((COUNTIF(OFFSET(A2:A14,ROW(A2:A14)-ROW(A2),0,C2),"<0")=C2)*SUBTOTAL(9,OFFSET($A$2:$A$14,ROW(A2:A14)-ROW($A$2),0,C2)))
Ctrl+Shift+Enter

D3
=MAX((COUNTIF(OFFSET(A2:A14,ROW(A2:A14)-ROW(A2),0,C3),">=0")=C3)*SUBTOTAL(9,OFFSET($A$2:$A$14,ROW(A2:A14)-ROW($A$2),0,C3)))
Ctrl+Shift+Enter

M.
 
Last edited:
Upvote 0
Remark

I edited the ranges in the first formula above
I was making tests with data in A2:A15.
But accordingly with data sample the proper range is A2:A14

M.
 
Upvote 0
Thanks for the excellent additions. Quite awesome. In addition to Aladin, I esp appreciate the additions from Domenic and Marcelo, and will be testing/trying these out Mon/Tue and post my follow up thereafter. With great appreciation and respect.
 
Upvote 0
Deleted: rethinking
 
Last edited:
Upvote 0
No VBA or arrays if you don't mind. Just a formula like:

=SUM (etc)
Then what about some helper columns to keep the formulas somewhat simpler?

So, to use your example, Peter, the max "winning streak" (count of consecutive cells with values of zero or greater) would be "4", which is taken from either A2:5 or A7:10 in your example. For the 2nd component, you've asked Peter, namely, the "sum", that would be A12:13 or answer "22" in your example.
.
That means I made a mistake in my original question slightly in "1" and "2" (sum-related). For those, they should read, instead: 1. SUM the largest cumulative LOSS

If I have interpreted that correctly then try this.

E4 remains empty.
E5 & F5 copied down to row 29.

Excel Workbook
DEFGHI
4valuecountsum
5-2-1-2neg1-5
611pos422
712
813
9144
10-5-1-5
1151
1252
1353
145420
15-2-1-2
1621
1720222
18-2-1-2
19
Streaks 2
 
Last edited:
Upvote 0
Then what about some helper columns to keep the formulas somewhat simpler?
Brilliant Peter! That style would work really well with mine since I tend to use a lot of helper columns & cells too. I can't wait to try this later today and followup thereafter. With kind regards for your efforts and attention to details. And of course I must share that sentiment with A, D & M as well naturally, or should I say natively, ha ;) Have a great day.
 
Upvote 0
P.S. (added a couple mins later): Peter, I just noticed column "G" and was curious if or how it ties in sir. It may just have been one of your own helper columns as you were working on this solution. Thanks for your clarification, if you would. Will be following up later today, with appreciation always.
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,965
Members
449,201
Latest member
Jamil ahmed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top