Count unique entries

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
On 2002-10-21 16:06, frankerrington wrote:
A column has 26,000 entries. Many are repeats. I'd like to count just the unique occurrences

In ascending order of preference...

If there are no formula generated blanks among your entries, use:

=COUNTDIFF(Range)

where Range refers to the range that houses those 26K entries.

COUNTDIFF is part of the morefunc.xll add-in, downloadable from:

http://longre.free.fr/english/index.html

A costly alternative is the following array-formula...

=SUM(IF(LEN(Range),1/COUNTIF(Range,Range)))

To array-enter a formula, you need to hit control+shift+enter at the same time, not just enter.
 

Corticus

Well-known Member
Joined
Apr 30, 2002
Messages
1,579
Without the add-in,

(I was already done with my solution when the first one popped up, so here's mine too)

I set up a sheet as follows:
CountUnique.xls
ABCD
1AAUnique
2CC10
3DD
4FF
5FS
6SE
7EW
8WR
9DT
10FG
11D
12E
13W
14R
15T
16F
17G
18D
19D
Sheet1


Then put the following code behind the sheet:
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

Range("A:A").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("B1"), Unique:=True

Application.EnableEvents = True
End Sub

HTH,
Corticus
This message was edited by Corticus on 2002-10-21 16:22
 

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654
On 2002-10-21 16:06, frankerrington wrote:
A column has 26,000 entries. Many are repeats. I'd like to count just the unique occurrences

If your column (e.g., A:A) consists only of numeric values you could employ the following array formula...

{=COUNT(IF(FREQUENCY(A:A,A:A),1))}

Note: Array formulas must be entered using the Control+Shift+Enter key combination. The outermost braces, { }, are not entered by you -- they're supplied by Excel in recognition of a properly entered array formula. For more on array formulas see the Excel Help topic for "About array formulas and how to enter them".
This message was edited by Mark W. on 2002-10-21 16:54
 

Watch MrExcel Video

Forum statistics

Threads
1,123,158
Messages
5,600,054
Members
414,357
Latest member
Gemma_R

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
Top