View Single Post
 
Old 03-21-2012, 09:40 AM
Catalin.B Catalin.B is offline Windows Vista Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

The formula you posted had some errors, i used this:
=IF(AND(P23>P22;SUM(O19:O22)<4);1;0) (for 4 consecutive rows)
To have in a cell the number of consecutive rows with 1 value, You must use sum with offset to accomplish that.
Assuming that in cell M3 you enter the number of consecutive rows with 1 value:
=IF(AND(P23>P22;SUM(OFFSET(O23;-$M$3;0;$M$3;1))<M$3);1;0) . Copy this down. (you must replace formula separators ; to ,)
In this case, OFFSET function creates a range of 1 column, with the number of rows = M3, placed above O23(that is the number of rows above O23: -$M$3)
Reply With Quote