+ Reply to Thread
Results 1 to 14 of 14

How to distinct count in Excel

  1. #1
    Registered User
    Join Date
    06-02-2015
    Location
    India
    MS-Off Ver
    2010, 2013
    Posts
    91

    How to distinct count in Excel

    Hi,

    I have sheet that contains 30,000 rows. I need to determine the number of distinct (unique) values in column A. What is the most efficient way to do this in
    Excel?

    Thanks

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: How to distinct count in Excel

    Distinct = all values that they appear once or many times
    Unique= values that appear only once

    Which do you need?

  3. #3
    Registered User
    Join Date
    08-08-2015
    Location
    Hong Kong
    MS-Off Ver
    Microsoft Excel for Mac 2011
    Posts
    5

    Re: How to distinct count in Excel

    Hi Terressa,

    Use the following formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    (You can edit the range yourself)

    Then press CTRL + SHIFT + ENTER

    Best,
    Ernching
    Last edited by Ernching; 08-08-2015 at 11:27 AM.

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to distinct count in Excel

    This will count the number of unique values (Alpha or Numeric) in a column and ignores blank cells.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Enter with Ctrl + Shift + Enter (Array formula)

    This will count unique numeric values:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So will this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Even though it looks like negative numbers and 0 would not be counted, they are.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to distinct count in Excel

    Assuming no empty cells within the data range.

    On a range of 30,000 cells this is the most efficient formula (fastest to calculate).

    Array entered**:

    =SUM(IF(FREQUENCY(MATCH(A1:A30000,A1:A30000,0),ROW(A1:A30000)-ROW(A1)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to distinct count in Excel

    Quote Originally Posted by Pepe Le Mokko View Post
    Distinct = all values that they appear once or many times
    Can you explain? Why then in Excel Advanced Filter with enabled option "Unique records only", Excel copies all values that they appear once or many times
    Thanks advance

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to distinct count in Excel

    Here is a small example:

    Here is an Advanced Filter that is filtered on the name Dexter - Unique records.

    A
    B
    C
    D
    E
    F
    G
    1
    Name Amount 1 Amount2 Name Amount 1 Amount2
    2
    Roy
    1
    2
    Dexter
    3
    Roy
    1
    2
    4
    Rex
    2
    3
    5
    Dexter
    3
    4
    Name Amount 1 Amount2
    6
    Dexter
    3
    4
    Dexter
    3
    4
    7
    Dexter
    5
    6
    Dexter
    5
    6




    As you can see on the right, there are 3 records for Dexter. Records on row 5 and 7 are unique. Dexter 3 4 has two entries but only 1 is returned by the filter and Dexter 5 6 has only 1 record so it is returned by the filter. All duplicate records are ignored.

    If you don't specify UNIQUE, the following is returned.
    A
    B
    C
    D
    E
    F
    G
    1
    Name Amount 1 Amount2 Name Amount 1 Amount2
    2
    Roy
    1
    2
    Dexter
    3
    Roy
    1
    2
    4
    Rex
    2
    3
    5
    Dexter
    3
    4
    Name Amount 1 Amount2
    6
    Dexter
    3
    4
    Dexter
    3
    4
    7
    Dexter
    5
    6
    Dexter
    3
    4
    8
    Dexter
    5
    6




    Here is an advanced filter without criteria other than Unique Records:
    A
    B
    C
    D
    E
    F
    G
    1
    Name Amount 1 Amount2 Name Amount 1 Amount2
    2
    Roy
    1
    2
    3
    Roy
    1
    2
    4
    Rex
    2
    3
    5
    Dexter
    3
    4
    Name Amount 1 Amount2
    6
    Dexter
    3
    4
    Roy
    1
    2
    7
    Dexter
    5
    6
    Rex
    2
    3
    8
    Dexter
    3
    4
    9
    Dexter
    5
    6
    Last edited by newdoverman; 08-13-2015 at 02:27 PM.

  8. #8
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to distinct count in Excel

    Quote Originally Posted by newdoverman View Post
    Here is a small example
    Thank you
    Can you see my example and enter formula for unique and distinct (sorted)
    Attached Files Attached Files

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to distinct count in Excel

    To get the UNIQUE values from the values in A1:A9
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Enter with Ctrl + Shift + Enter

    To have Unique values from A1:A9 extracted in order small to large:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Enter with Ctrl + Shift + Enter

    To get a Distinct list from A1:A9 : (values appearing only once in the list)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is an unordered list which cannot be sorted unless the list is copied and then paste values is applied.

  10. #10
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to distinct count in Excel

    Quote Originally Posted by newdoverman View Post
    To get the UNIQUE values from the values in A1:A9
    To have Unique values from A1:A9 extracted in order small to large:
    To get a Distinct list from A1:A9 : (values appearing only once in the list)
    This is an unordered list which cannot be sorted unless the list is copied and then paste values is applied.
    Thank you very much for answer

    [edit]
    I'm a little confused.
    According to this definition,
    from Pepe Le Mokko
    Distinct = all values that they appear once or many times
    Unique= values that appear only once
    and your formula
    To get a Distinct list from A1:A9 : (values appearing only once in the list)
    Formula:
    =IFERROR(INDEX($A$2:$A$9,MATCH(0,INDEX(COUNTIF($F$1:F1,$A$2:$A$9)+(COUNTIF($A$2:$A$9,$A$2:$A$9)<>1),0,0),0)),"")
    it confuses me, I want to resolve this dilemma
    Last edited by Dumy; 08-14-2015 at 11:01 AM. Reason: I want to resolve this dilemma

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to distinct count in Excel

    Unique values are those values that appear only once in a list after all duplicate values are removed. That means if 5 is in a list 5 times it will be counted once as a Unique value. Distinct values only appear in a list 1 time and have no duplicates.

  12. #12
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to distinct count in Excel

    Quote Originally Posted by newdoverman View Post
    Distinct values only appear in a list 1 time and have no duplicates.
    OK, probably Pepe Le Mokko made a mistake
    Thank you

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to distinct count in Excel

    Unique in Excel is demonstrated in the 3rd example that I gave you in message #7. The Unique values given on the right side have duplicated values in the original.

    I think that Microsoft plays a little loosely with language and the terms don't necessarily exactly line up with dictionary definitions.

    The Oxford dictionary defines UNIQUE "of which there is only one; unequalled; having no like, equal or parallel" There is more but this is what pertains to us.

    The Oxford dictionary defines DISTINCT "not identical; separate; individual" and more....

    This, I think, shows that English is not very exact at times. The thing is that you have to know how the terms are being used within the programs that you are using.

  14. #14
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: How to distinct count in Excel

    Fantastic, Thank you for your explain

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to count distinct values in Excel
    By Arpita_Excel in forum Excel General
    Replies: 7
    Last Post: 07-22-2015, 02:05 AM
  2. count distinct values in excel
    By annux08 in forum Excel General
    Replies: 3
    Last Post: 07-13-2015, 09:21 AM
  3. [SOLVED] Excel - Count distinct occurences and copy unique values
    By random0munky in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-26-2015, 10:41 PM
  4. How to Count Distinct Values in Excel
    By kisanvikas2015 in forum Excel General
    Replies: 2
    Last Post: 05-19-2015, 10:12 AM
  5. [SOLVED] Pivot Table that performs a distinct count in excel 2013
    By tdf2437 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 09-09-2014, 09:03 AM
  6. Count distinct in excel
    By akshaykadidal in forum Tips and Tutorials
    Replies: 3
    Last Post: 01-07-2014, 08:20 AM
  7. [SOLVED] how can I count distinct names in an excel list?
    By RPC@Frito in forum Excel General
    Replies: 5
    Last Post: 02-03-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1