Longest Streak of Zero and Non Zero numbers

boxford

New Member
Joined
Mar 12, 2021
Messages
5
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, first sorry for not using XL2BB, my company will not allow addons. I am looking for a way to count the longest string of days I have no sales and the longest string of days I do have sales. I got the array formula correct on the non sales number of days, but cannot get the longest to work.

Here is the formula I use for longest non-sales streak: =MAX(FREQUENCY(IF($A$2:$A$50=0,ROW($A$2:$A$50)),IF($A$2:$A$50<>0,ROW($A$2:$A$50))))

Any help would be appreciated.

1615576847285.png
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi & welcome to MrExcel.
How about
Excel Formula:
=MAX(FREQUENCY(IF($A$2:$A$50>0,ROW($A$2:$A$50)),IF($A$2:$A$50=0,ROW($A$2:$A$50))))
 
Upvote 0
That's it! Thank you so much. But now when I changed the absolute number below so that I can continue to add daily numbers, my streak of zero is now 979. Do I need to use a IFERROR in the formula somehow?

=MAX(FREQUENCY(IF($A$2:$A$1000=0,ROW($A$2:$A$1000)),IF($A$2:$A$1000<>0,ROW($A$2:$A$1000))))
 
Upvote 0
Try
Excel Formula:
=MAX(FREQUENCY(IF($A$2:$A$1000<>"",IF($A$2:$A$1000=0,ROW($A$2:$A$1000))),IF($A$2:$A$1000<>0,ROW($A$2:$A$1000))))
otherwise the blank cells are treated as 0
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

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