AllExperts > Excel 
Search      
Excel
Volunteer
Answers to thousands of questions
 Home · More Excel Questions · Answer Library  · Encyclopedia ·
More Excel Answers
Question Library

Ask a question about Excel
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Bill Hermanson
Expertise
Please tell me WHICH EXCEL VERSION you are using!

DO NOT ASK ME me about Macros or VBA.

Please read my "instructions to questioners" in my full profile [use View Profile, at right], to help you write a question that I can understand, without having to ask you what you mean.

If your question contains any of the words THIS, IT, THAT, THOSE, or THEY, I likely won't understand IT. Please rewrite!

My Expertise: I am an expert at data manipulation, the use of incredibly complex logical statements, databases, combining tables and extracting data, all the LOGICAL, LOOKUP & REFERENCE functions, dynamic ranges, creating professional appearing spreadsheets, complex functions, integrated charts and visual displays, user interfaces.... I can make Excel do anything!

But PLEASE... NO MACRO or VBA QUESTIONS!

Experience
25 years development of complex spreadsheets for personal and professional use. I've developed hundreds (or thousands!) of spreadsheets in all fields, from complex engineering calculations to game scoring, financial analysis, scheduling, cost-of-doing-business, and analysis of home energy use. I even used Excel to assist in design of the flight computers presently on board the Hubble Space Telescope (1984-1991)

Education/Credentials
BSEE Electrical Engineering, CU Boulder CO USA
Use of spreadsheets since 1982
Boulder Valley School District, Life Long Learning, Instructor
Owner & Operator of Excel Expert, LLC

 
   

You are here:  Experts > Computing/Technology > Microsoft Software > Excel > Excel Counting the max amount of consecutive positive numbers

Excel - Excel Counting the max amount of consecutive positive numbers


Expert: Bill Hermanson - 10/30/2009

Question
I have one column in an Excel spreadsheet and would like to count the highest maximum amount of times in a row I consecutively get positive numbers before hitting a negative number. For example in the following the answer should be 5.

P/L
0.07
0.19
0.02
-0.01
0.00
0.02
0.10
0.14
0.06
-0.02
0.03
0.04

Thank you in advance for any help you can provide.

Ed


Answer
Ed,

   You need to add a column of Logical Equations next to your column of numbers.  each logical equation will say:

  "IF the number to the left is POSITIVE, increment the number above me by 1, otherwise, put in a zero"

  Then at the top of this column, take the MAX() of the entire column.

 This IF statement, if in cell B10, will look like:

  =IF(A10>0,B9+1,0)

 That's all you need.

   You didn't specify what should happen if the number IS zero, so I counted zero as a negative.

  >>> Bill  

View Follow-Ups    Add to this Answer   Ask a Question


 
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.