# Difficulties with a formula to count continous instances

#### Patrokles

##### New Member
Dear all,

I hope you can help me out with a problem I can't figure out myself.
The problem is that I have a data sheat, in which I need to measure the longest uninterrupted number of intervals that the variable is below a certain number. Lets say 37. And the zero's are not included. In the following row the variable is 7 times below 37, and the maximum length of longest uninterrupted number of intervals is 4.
So basically I am looking for a formula that gives me the number 4.
I hope somebody is able to help me out

 0 28 26 0 23 26 27 29 38 40 33 0

<tbody>
</tbody>

### Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

#### XOR LX

##### Well-known Member
Hi.

Assuming your list is in A1:A12 and you put your threshold value, e.g. 37, in B1, this array formula** should give you your desired result:

=MAX(FREQUENCY(IF(B1>A1:A12,IF(A1:A12<>0,ROW(A1:A12))),IF((A1:A12>=B1)+(A1:A12=0),ROW(A1:A12))))

Regards

**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

#### Patrokles

##### New Member
Thank you for your swift respons. However, Excel keeps showing an error message after pressing CTRL + SHIFT + ENTER. The error concerns the part A1:A12,ROW. It appears to be that the comma is the cause of the error.
Note: I use a dutch version of Excel.

Regards

#### Oeldere

##### Well-known Member
Then you need to change the , (colon) into ; (semi-colon)

Replies
0
Views
1K
Replies
4
Views
1K
Replies
42
Views
3K
Replies
4
Views
556
Replies
3
Views
391

1,195,722
Messages
6,011,309
Members
441,604
Latest member
CraigThompson

### 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.

### Which adblocker are you using?

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

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