Counting each occurrence of consecutive values in a column

spill-the-beans

Board Regular
Joined
Feb 7, 2013
Messages
52
Hello,

I have a rather large dataset, and apart from the top row (which is a header row), all the data is either a 0 or a 1. Just looking at one column, I could have something like:

AB
indexdata
10
20
31
41
51
60
70
80
91
101
110
121
131
141
151

<tbody>
</tbody>

In another sheet, I would like a summary of information in just the data column B. There are two things I need to know:

1. How many series of 1s (so 2 or more 1s one after the other vertically) there were in the entire column. There will never be a 1 by itself with a 0 both above and below it.

2. How long each individual series was - so how many 1s there were in that vertical series.

So for the example above, I would ideally end up with something that looks like:

How many series?3
Length of 1st series3
Length of 2nd series2
Length of 3rd series4

<tbody>
</tbody>

If anyone can help me, please let me know! At the moment I am counting by hand!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,661
Messages
6,120,796
Members
448,994
Latest member
rohitsomani

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