Count Longest Streak

mrjnice85

New Member
Joined
May 12, 2015
Messages
9
Hey everyone,

I have an excel file that I would like to capture the longest streak of cells that contain a number greater than 0. I currently have an array formula in cell J14:

{=MAX(FREQUENCY(IF(L14:AM14<>$BI$83,COLUMN(L14:AM14)), IF(L14:AM14=$BI$83,COLUMN(L14:AM14))))} ($BI$83 is just an empty cell)

The problem I run into is that all the cells in that range of L14:AM14 are formulas. So my array can't use >0 or =0. The problem with that existing array is it includes cells which the value of the formula is "x" or "ooc". I'm not overly confident with array's and I pieced that formula together through luck of searching around but haven't found out how to omit the "x" and "occ". Any help would be greatly appreciated. Here is an example of the table below:

[TABLE="class: grid, width: 800"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]J[/TD]
[TD="align: center"]K[/TD]
[TD="align: center"]L[/TD]
[TD="align: center"]M[/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]O[/TD]
[TD="align: center"]P[/TD]
[TD="align: center"]Q[/TD]
[TD="align: center"]R[/TD]
[TD="align: center"]S[/TD]
[TD="align: center"]T[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Username[/TD]
[TD="align: center"]Longest Streak[/TD]
[TD="align: center"][/TD]
[TD="align: center"]944[/TD]
[TD="align: center"]943[/TD]
[TD="align: center"]942[/TD]
[TD="align: center"]941[/TD]
[TD="align: center"]940[/TD]
[TD="align: center"]939[/TD]
[TD="align: center"]938[/TD]
[TD="align: center"]937[/TD]
[TD="align: center"]936[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[TD="align: center"]---[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]Eliboyi[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[TD="align: center"]OOC[/TD]
[TD="align: center"]x[/TD]
[TD="align: center"]12324[/TD]
[TD="align: center"]12452[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]9708[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]8000[/TD]
[/TR]
[TR]
[TD="align: center"]21[/TD]
[TD="align: center"]Gibsy[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[TD="align: center"]15536[/TD]
[TD="align: center"]11996[/TD]
[TD="align: center"]12404[/TD]
[TD="align: center"]9352[/TD]
[TD="align: center"]9360[/TD]
[TD="align: center"]0[/TD]
[TD="align: center"]9256[/TD]
[TD="align: center"]12468[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

As you can see for J14 it returns a streak of 4 when it should only be 2 since we don't want to include the OOC's or X
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try...

=MAX(FREQUENCY(IF(ISNUMBER(L14:AM14),IF(L14:AM14>0,COLUMN(L14:AM14))),IF((1-ISNUMBER(L14:AM14))+(L14:AM14=0),COLUMN(L14:AM14))))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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