+ Reply to Thread
Results 1 to 10 of 10

Return Unique Count

  1. #1
    Registered User
    Join Date
    06-10-2014
    Posts
    21

    Return Unique Count

    Hi All,

    Apologies if this has already been covered.

    I am hoping someone can help me with a formula.

    See the example file attached.

    I want to return a unique count based on the ID and Comment columns (ignoring blank comments).

    So for the data in the example file it should return a result of 3.

    I know I can easily do it with a helper column, but would ideally like a solution that didn't require one.

    I have tried various formulas I have found online, but can't quite get any of them to work. I also need a formula that will work in both Excel 2016 and Excel 365.

    Any help would be appreciated. Many thanks.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: Return Unique Count

    use the formula in i2:
    Please Login or Register  to view this content.
    see the attached file
    Attached Files Attached Files

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Return Unique Count

    .
    In D2, copied down :

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-11-2021
    Location
    CANADA
    MS-Off Ver
    Excel 2007, Office 2019
    Posts
    31

    Re: Return Unique Count

    =SUM(N(FREQUENCY(IF(C2:C9<>"",MATCH(A2:A9&C2:C9,A2:A9&C2:C9,0)),MATCH(A2:A9&C2:C9,A2:A9&C2:C9,0))>0))

    array formula: press CTRL+SHIFT+ENTER, not just ENTER

  5. #5
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Return Unique Count

    I love that someone remembered that FREQUENCY idiom, but SUM is unnecessary.

    =COUNT(1/FREQUENCY(IF(somerange<>"",MATCH(...),ROW(somerange)-CELL("row",somerange))))

    produces the distinct count. Note that the MATCH call is only needed in FREQUENCY's 1st argument. FREQUENCY's 2nd argument can/SHOULD be just a simple array of sequential integers beginning with 0.

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,591

    Re: Return Unique Count

    Try this

    =SUMPRODUCT(($C$2:$C$9<>"")*(1/COUNTIFS($A$2:$A$9,$A$2:$A$9&"",$C$2:$C$9,$C$2:$C$9&"",$C$2:$C$9,"<>""")))
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Return Unique Count

    Are you sure that last condition should be "<>"""? Does that mean cells in C2:C9 wouldn't equal a single double quote character?

  8. #8
    Registered User
    Join Date
    06-10-2014
    Posts
    21

    Re: Return Unique Count

    Thanks you all for your replies and solutions. It's much appreciated.

    I have now been able to apply these solutions to a larger dataset and they work perfectly.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,125

    Re: Return Unique Count

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Return Unique Count

    .
    You are welcome. Glad you have a solution.

+ 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. Replies: 11
    Last Post: 01-30-2020, 04:34 AM
  2. [SOLVED] Return Unique Values with count
    By jeffreybrown in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-07-2019, 11:00 AM
  3. Return count of Postal Code based unique value
    By SVTF in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 05-31-2017, 08:37 PM
  4. Return Count of Unique Text Entries in a Column
    By Charlie14 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2017, 10:48 AM
  5. [SOLVED] Using INDEX MATCH to return unique values for non-unique search term
    By rico_suave in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-03-2015, 01:53 AM
  6. Return Unique Items based on Count ans descending
    By jhall488 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2014, 04:30 PM
  7. Replies: 0
    Last Post: 03-22-2012, 08:44 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