Count continuous cells as one in a column

ksillas

New Member
Joined
Jun 29, 2017
Messages
15
Hello,

I need to count "grouped" cells with values as one. Column "I" has bunch of 1's and 0's if it was on or off. I already deleted all the 0's and was left with 1's and empty cells in between. For example:

1
1
1
1
1
1
1
1

<tbody>
</tbody>

This has 3 "groups" so the end count would be 3.

To do it manually I would press CTRL+Down Arrow twice (once to reach the first cell with content, the second one to reach the last cell with content) and that would count as 1 "group."


If you guys need more information I'm glad to explain further. The excel file (per day) contains around 200K rows , it's like a log file that records every 300ish milliseconds..
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If the cells contain values rather than formulae try
Code:
Sub ksillas()
   MsgBox Range("I:I").SpecialCells(xlConstants).Areas.Count
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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