# Consecutive amounts greater than 2500

#### rodgo

##### New Member
I have a row of numbers. I would like to get the number of consecutive times the number is above 2500. For example, A1 through Z1 contain numbers. If C1 through E1 contain numbers above 2500 I want the number returned to be 3. Now, if there are several times that this happens between A1 and Z1, then i want the 'longest streak'.

Please tell me you all understand!?!?!

### Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

#### acw

##### MrExcel MVP
Hi

A2: =IF(A1>2500,1,0)
B2: =IF(B1>2500,A2+1,0)
copy from B2 to Z2
A3: =MAX(A2:Z2)

Another way would be to build your own function. Something like

Code:
``````Function MyFunc(ra As Range, tester)
final = 0
interim = 0
For Each ce In ra
If ce > tester Then
interim = interim + 1
Else
If interim > final Then
final = interim
End If
interim = 0
End If
Next ce
MyFunc = final
End Function``````

With your data in the range A1:Z1 use the formula in the form
=myfunc(A1:Z1,2500)

HTH

Tony

#### Domenic

##### MrExcel MVP
Here's another way...

=MAX(FREQUENCY(IF(A1:Z1>2500,COLUMN(A1:Z1)),IF(A1:Z1<=2500,COLUMN(A1:Z1))))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!

Replies
14
Views
667
Replies
2
Views
202
Replies
0
Views
162
Replies
3
Views
241
Replies
0
Views
1K

1,170,932
Messages
5,872,776
Members
432,944
Latest member
mj02

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