In range A1:A100, there are dates. In range B1:B100, there are positive and negative numbers.
1/2/2019 -5
1/3/2019 -51
1/4/2019 100
1/7/2019 27
1/8/2019 -35
1/9/2019 52
1/10/2019 26
1/11/2019 19
1/12/2019 -42
1/13/2019 -213
1/14/2019 -79
Now, I have figured out how to find the longest consecutive streak of positive and negative values. However, I would also like to find the sum of those streaks. Ideally, I would like to not use helper columns. (I apologize for the poor table formatting.)
I found a solution that works in Excel but for some reason fails in Google Sheets, available here: https://www.mrexcel.com/forum/excel-questions/330468-sum-longest-streak.html The provided formula when copied to Google Sheets results in an error stating that there is no valid input for the small() function. I've compared Excel to Google Sheets side by side and the formula is successful in Excel but not Sheets.
Positive streak: ArrayFormula(MAX(FREQUENCY(IF(ISNUMBER(B:B),IF(B:B>=0,ROW(B:B))),IF(B:B<0,ROW(B:B)))))
Negative streak: ArrayFormula(MAX(FREQUENCY(IF(B1:B99<0,A1:A99),IF(B1:B99>=0,A1:A99))))
There may be more than 1 longest streak. I would like to return the one with the greatest sum, if possible.
The positive streak sum should be 97 and the negative streak should be -334.