VB to Count till Change

Mithmacil

New Member
Joined
Feb 8, 2012
Messages
6
I don't do much with VB and need some help to count/tally up the number of instances of a given value.
Data is sorted by the value so all results are together just need a ongoing count till value changes or cell is blank
Value, Expected Result
23589, 1
23589, 2
23589, 3
23599, 1
23599, 2
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I have a question:

Looking at your example showing commas after the value and then the count, is it correct to assume that you want the data all in one column or is the data in one column and the count in the adjacent column. If it's two columns then what do you want done with the commas?
 
Upvote 0
The commas are to show a column separation. Data is in first column and count result would be the second column.
 
Upvote 0
How about just a simple formula. If your data starts in Cell A2 then cell B2 = 1 (assuming headers in Row 1). From that point in cell B3 and you could use

=IF(A3=A2,B2+1,1)

copied down column B.
 
Upvote 0

Forum statistics

Threads
1,216,189
Messages
6,129,403
Members
449,509
Latest member
ajbooisen

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