ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Number of Occurences In range (https://www.excelbanter.com/excel-programming/278084-number-occurences-range.html)

markawmaw

Number of Occurences In range
 
I have a range in a worksheet and need to progmatically determine the
number of occurences of each piece of data.

Can anyone help me out please. As an example cells A1:A10 might
contain:

A1 Fred
A2 Peter
A3 Peter
A4 Fred
A5 John
A6 Simon
A7 Paul
A8 Mark
A9 Luke
A10 Simon

I need to return:

Fred 2
Peter 2
John 1
Simon 2
Paul 1
Mark 1
Luke 1

Tim Childs

Number of Occurences In range
 
Hi

you can use COUNTIF worksheet function in code itself

see Chip's site at cpearson.com

hth

Tim

-----Original Message-----
I have a range in a worksheet and need to progmatically

determine the
number of occurences of each piece of data.

Can anyone help me out please. As an example cells A1:A10

might
contain:

A1 Fred
A2 Peter
A3 Peter
A4 Fred
A5 John
A6 Simon
A7 Paul
A8 Mark
A9 Luke
A10 Simon

I need to return:

Fred 2
Peter 2
John 1
Simon 2
Paul 1
Mark 1
Luke 1
.



All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com