![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I would like to know how many unique values I have in a given list / range.
Is there a formula to return this number. The data is generally alphanumeric. Thanks Sean |
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: United Kingdom
Posts: 68
|
I assume by unique numbers, you merely want to count how many different numbers appear in the list?
If so, a Pivot Table would do it quite easily. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 232
|
you could try sorting your list and using the Data-> Subtotal function.
This groups up your data and subtotals the group. |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=IF(LEN(A1:A6),SUMPRODUCT(1/COUNTIF(A1:A6,A1:A6))) |
|
|
|
|
|
|
#5 |
|
Join Date: Feb 2002
Posts: 39
|
In addition to the responses already supplied, here's a UDF :-
Function Uniques(Rng As Range) As Long Dim cell As Range, UniqueValues As New Collection Application.Volatile On Error Resume Next For Each cell In Rng UniqueValues.Add cell.Value, CStr(cell.Value) Next cell On Error GoTo 0 Uniques = UniqueValues.Count End Function |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: May 2004
Location: Aurora, Colorado
Posts: 4,237
|
What if you want to know not only the count of each unique item, but the items themselves? There could be small differences between the items, which you would want accounted for.
P.S. I love this forum! I've thought about posting many times, only to find the exact solution I needed! Kudos to all!
__________________
Todd Seward Building Successful Technical Solutions Learn something new every day! Professional Profile: http://www.linkedin.com/in/toddseward http://twitter.com/toddseward http://www.facebook.com/todd.seward?ref=name |
|
|
|
|
|
#7 | |
|
Board Regular
Join Date: Feb 2002
Posts: 7,743
|
Quote:
http://216.92.17.166/board2/viewtopic.php?t=8659 Aladin's revised method |
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Hi Taz:
Welcome to MrExcel Board! Do you mean to say you would like to extract all those items that are unique (meaning suppressing the duplicates)? -- if so then the UNIQUEVALUES function from the Morefunc add-in should do the job. I am sorry ... I did not understand the part of your statement ... There could be small differences between the items, which you would want accounted for.
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: May 2004
Location: Aurora, Colorado
Posts: 4,237
|
Quote:
In the 2nd part of my post, I just meant that you'd want to count all the unique items, not just ones that are "close." You can ignore that part...no worries. Thanks for all the help!
__________________
Todd Seward Building Successful Technical Solutions Learn something new every day! Professional Profile: http://www.linkedin.com/in/toddseward http://twitter.com/toddseward http://www.facebook.com/todd.seward?ref=name |
|
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
http://216.92.17.166/board2/viewtopi...light=distinct describes a fast formula system to extract unique/distinct items from a range. Method 1 (Brian refers to) in: http://216.92.17.166/board2/viewtopi...r=asc&start=20 sorts and extracts such a list. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|