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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
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
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,702
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!
 

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
"I believe the following would suffice... "

Serves me right for doing a cut & paste!
 

Forum statistics

Threads
1,136,926
Messages
5,678,605
Members
419,775
Latest member
joh93

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
Top