View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Find the Longest Run.

Assuming there are no empty cells in the range...

Both formulas are array formulas**.

Longest run =0:

=MAX(FREQUENCY(IF(rng=0,ROW(rng)),IF(rng<0,ROW(rn g))))

Longest run <0:

=MAX(FREQUENCY(IF(rng<0,ROW(rng)),IF(rng=0,ROW(rn g))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

--
Biff
Microsoft Excel MVP


"dlbeiler" wrote in message
...
I have a column of random numbers that are conditionally formatted for the
font to be blue if the number is = 0 and red if <0. How do I find the
longest run of numbers that are = than 0 and the longest run that are < 0
within the column.