Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

 How to count max number of consecutive positive / negative numbers in Excel?

If you have a list of data which mix with positive and negative numbers, and now, you want to count the max number of consecutive positive and negative numbers as following screenshot shown, how could you deal with this task in Excel?

Count the max number of consecutive positive and negative numbers with array formulas


Count the max number of consecutive positive and negative numbers with array formulas


To get the max number of consecutive positive and negative numbers, please apply the following array formulas:

Count the max number of consecutive positive numbers:

Enter this formula into a cell where you want to get the result:

=MAX(FREQUENCY(IF(A2:A20>0,ROW(A2:A20)),IF(A2:A20<=0,ROW(A2:A20)))), and then press Ctrl + Shift + Enter keys together, and you will get the correct result as you need, see screenshot:


Count the max number of consecutive negative numbers:

Enter this formula into a cell where you want to get the result:

=MAX(FREQUENCY(IF(A2:A20<0,ROW(A2:A20)),IF(A2:A20>=0,ROW(A2:A20)))), and then press Ctrl + Shift + Enter keys simultaneously, and you will get the result as you need, see screenshot:

Note: In the above formulas, A2:A20 is the list of cell range which you want to use.


Recommended Productivity Tools for Excel

kte tab 201905

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Ryan · 4 months ago
    How do you do this with multiple rows? say A1:A10 and C1:C10 ???
    • To post as a guest, your comment is unpublished.
      skyyang · 3 months ago
      Hello, Ryan,
      Sorry for that, this formula is only applied to single column or row.
      If you have other good ideals, please comment here.
      Thank you!
  • To post as a guest, your comment is unpublished.
    Ivan · 10 months ago
    Not working! Gives the max number of positive results not consecutive ones
    • To post as a guest, your comment is unpublished.
      skyyang · 10 months ago
      Hi, Ivan,
      The above formula only can help you to count the max number of the positive or negative numbers, it can't extract the consecutive cells.
      If you have the good ways, please comment here.
      Thank you!
  • To post as a guest, your comment is unpublished.
    Leandro · 1 years ago
    Excelente! Funcionou perfeitamente. E se quisermos somar os números de cada intervalo, como ficaria?
  • To post as a guest, your comment is unpublished.
    Shailendra Agrawal · 1 years ago
    I want the consecutive positive numbers from last cell of one column in which data is entered. I will have many column i.e. A,B,C,D,E,F etc
  • To post as a guest, your comment is unpublished.
    Shailendra Agrawal · 1 years ago
    I want the consecutive positive numbers from last of one column. I will have many column i.e. A,B,C,D,E,F etc