Count occurrences of consecutive text

Alfie101

New Member
Joined
Jan 29, 2016
Messages
19
Hi,
Is there a formula to count occurrences of consecutive text in a lengthy file, and put the number in an adjacent column, as in the sample below:
[TABLE="width: 351"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]019DAEA5-7213-4CA8-A421-C8E6696CFE10
[/TD]
[TD="align: right"]3
[/TD]
[/TR]
[TR]
[TD]019DAEA5-7213-4CA8-A421-C8E6696CFE10
[/TD]
[TD="align: right"]3
[/TD]
[/TR]
[TR]
[TD]019DAEA5-7213-4CA8-A421-C8E6696CFE10
[/TD]
[TD="align: right"]3
[/TD]
[/TR]
[TR]
[TD]019DDD1C-3563-4A32-AEDB-7109DD5C7FD2
[/TD]
[TD="align: right"]2
[/TD]
[/TR]
[TR]
[TD]019DDD1C-3563-4A32-AEDB-7109DD5C7FD2
[/TD]
[TD="align: right"]2
[/TD]
[/TR]
[TR]
[TD]01C8BF3D-217F-4219-ABE2-AD8D779BDC8C
[/TD]
[TD="align: right"]5
[/TD]
[/TR]
[TR]
[TD]01C8BF3D-217F-4219-ABE2-AD8D779BDC8C
[/TD]
[TD="align: right"]5
[/TD]
[/TR]
[TR]
[TD]01C8BF3D-217F-4219-ABE2-AD8D779BDC8C
[/TD]
[TD="align: right"]5
[/TD]
[/TR]
[TR]
[TD]01C8BF3D-217F-4219-ABE2-AD8D779BDC8C
[/TD]
[TD="align: right"]5
[/TD]
[/TR]
[TR]
[TD]01C8BF3D-217F-4219-ABE2-AD8D779BDC8C
[/TD]
[TD="align: right"]5
[/TD]
[/TR]
</tbody>[/TABLE]

Would greatly appreciate help with this. Thank you,
Alfie101
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Is this a sorted list? If so you can just do a countif. If not it will be more complex and right now i cant think how you could do that.
 
Upvote 0
Is this a sorted list? If so you can just do a countif. If not it will be more complex and right now i cant think how you could do that.
It does not matter whether the list is sorted or not, COUNTIF is still the way to go. Assuming the first value is in cell A1...

=COUNTIF(A$1:A$10,A1)

Where the red highlighted number is the last row number with data in it.
 
Upvote 0
Is this a sorted list? If so you can just do a countif. If not it will be more complex and right now i cant think how you could do that.

Hi Steve,

I apologize, to explain: the sample is what I hope to end up with. That is, with the current list of text items (column 1), ordered by the text items in that field, and with a count of the consecutive occurrences of column 1 entered into column 2.

Thank you, hope that is clear,

Alfie101
 
Upvote 0
I was thinking it may matter that if the value reoccured elsewhere in the list it started a new count. If that isnt the case then of course it doesnt matter if the list is sorted.
 
Upvote 0
It does not matter whether the list is sorted or not, COUNTIF is still the way to go. Assuming the first value is in cell A1...

=COUNTIF(A$1:A$10,A1)

Where the red highlighted number is the last row number with data in it.

Worked a charm. Thank you very much Rick, regards Alfie101
Thank you also Steve, appreciated, Alfie101
 
Upvote 0
Hi Steve,

I apologize, to explain: the sample is what I hope to end up with. That is, with the current list of text items (column 1), ordered by the text items in that field, and with a count of the consecutive occurrences of column 1 entered into column 2.

Thank you, hope that is clear,

Alfie101
Thank you Steve, I have it fixed now, appreciate your help, Alfie101
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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