Count no. of different entries in column

j844929

Active Member
Joined
Aug 18, 2002
Messages
423
Hi,

I have numerous columns that I would like to analyse, but can't seem to get the correct calculation.

For instance, column A contains company numbers, ie. :118,119,132,145,157

I was just wondering whether someone could give me a calculation similar to a =countif() or =count() that would return "5", telling me there are 5 different numbers in column A...? The other thing is that it has to work for text as well...

Any ideas would be gratefully received...

Tim
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Seems to work if there is only one instance of the number, but each company number appears in the column about 200 times.....

Is there another way to do it?
 
Upvote 0
It is, but it isn't...

I've figured out what the problem is. I don't know how many rows of data I'm going to have, but it will be less than 10,000; thus when I entered the function, I wanted to analyse from row A2:A9999, this caused a #DIV/0! problem.

It did, however, work when I analysed only 2157 rows of data that I currently have...

I was just wondering if there was a way to build this other factor into the function.....
 
Upvote 0
Sorry but I cannot see what is causing your problem, blank cells in the range should not cause problems.

Only issue I can see is that it is an expensive formula and could take a while to calculate on a large range.

A Pivot table can be en alternative.
 
Upvote 0
I was beginning to think along the lines of pivot table as well. The function works well enough to use it, however. I'll just have to change the formula when more data is added.

Thanks.
 
Upvote 0
... still dont get why you cannot have the whole range from the start. Is there something in the cells or are they blank?
 
Upvote 0
They're blank. It's a really strange one, I just can't figure it out...

The information is in a sheet called AggregatedData, and I wrote the function thus:

=SUMPRODUCT((AggregatedData!$A$2:$A$9999<>"")/COUNTIF(AggregatedData!$A$2:$A$9999,AggregatedData!$A$2:$A$9999&""))

But this didn't work... Still can't figure why.
 
Upvote 0

Forum statistics

Threads
1,223,289
Messages
6,171,235
Members
452,391
Latest member
BHG

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