Counting methods

gaw1za

New Member
Joined
Dec 20, 2004
Messages
14
How can you determine the longest run in the following sequence?
1
1
1
1
2
2
1
1
1
2

The answer from a general formula I am looking for here is 4 for "1's"and 2 for "2's".

Also, if you have a list (for example of claims) that go up in increments (after every x days for example), is there a way of determining when last it went up, eg:

1
1
1
1
2
2
3
3
3
3

The formula would for example determine that we went from 2 to 3 claims, 4 days ago. It would determine that we went from 1 to 2 claims, 6 days ago.

Thanks very much!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
given data in a1:a20, and a 1 in B1 (as the target series to count):

longest run:

=MAX(IF(FREQUENCY(IF(A1:A20=1,ROW(A1:A20)),IF(A1:A20<>1,ROW(A1:A20))),FREQUENCY(IF(A1:A20=1,ROW(A1:A20)),IF(A1:A20<>1,ROW(A1:A20)))))

...entered with control + shift + enter, not just enter.

end of increment:

=COUNT(A:A)-MATCH(B1+1,A:A,0)+1

...entered normally
 
Upvote 0
I believe the following would suffice...

=MAX(FREQUENCY(IF(A1:A20=1,ROW(A1:A20)),IF(A1:A20<>1,ROW(A1:A20))))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0
"I believe the following would suffice... "

Serves me right for doing a cut & paste!
 
Upvote 0

Forum statistics

Threads
1,214,428
Messages
6,119,420
Members
448,895
Latest member
omarahmed1

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