+ Reply to Thread
Results 1 to 13 of 13

Count unique values until particular value encountered

  1. #1
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Count unique values until particular value encountered

    First post, sorry if I don't explain this well.

    I'm trying to count the number of unique participants in each conference that we have had over the last few months, and I'm having trouble getting a formula that I can copy through a whole column.

    So in excel speak I'm trying to count the number of unique non-numerical values in column D until a particular non-numerical value(in this case "(blank)") is encountered. This formula needs to occur when there is any value in a third column, in this case column B. The current formula that I have is as follows:

    =IF(B16<> "",COUNTA(D16:INDEX($D16:D$2222,MATCH(TRUE,($D17:D$2222= "(blank)"),0))),"")

    This counts the number of values until we reach "(blank)", but I need to find the number of UNIQUE values. My question is how do I count only the unique values until "(blank)" is reached?

    Thanks for any help.

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

    Re: Count unique values until particular value encountered

    Can you post a SMALL sample file and show us what result you expect?

    20 rows worth of data is plenty. Remember, it's a SAMPLE file! In the *.xlsx file format that would be a file of about 10kb.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Re: Count unique values until particular value encountered

    Hope this works:

    expected
    date name configured name number of connections Number of Unique Connections
    (blank) (blank) (blank)
    1 April 2016 3800 - DAI Madison DAI-BHS 6 3
    Chicago Deportation Court
    Chicago Deportation Court
    Madison DAI-BHS
    Fox Lake AD-DAI
    Fox Lake AD-DAI
    (blank)
    3801 DAI Chicago Deportation Court 3 3
    Madison DAI-BHS
    New Lisbon AD-DAI
    (blank)

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

    Re: Count unique values until particular value encountered

    Is "(blank)" the actual text entry or does that mean an empty cell?

  5. #5
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Re: Count unique values until particular value encountered

    "(blank)" is an actual text entry.

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

    Re: Count unique values until particular value encountered

    This seems to work...

    Data Range
    B
    C
    D
    1
    ------
    2
    3800 - DAI
    Madison DAI-BHS
    3
    3
    Chicago Deportation Court
    4
    Chicago Deportation Court
    5
    Madison DAI-BHS
    6
    Fox Lake AD-DAI
    7
    Fox Lake AD-DAI
    8
    (blank)
    9
    3801 DAI
    Chicago Deportation Court
    3
    10
    Madison DAI-BHS
    11
    New Lisbon AD-DAI
    12
    (blank)
    13


    This formula entered in D2 and copied down:

    =IF(B2="","",SUMPRODUCT(1/COUNTIF(C2:INDEX(C2:C$12,MATCH("(blank)",C2:C$12,0)-1),C2:INDEX(C2:C$12,MATCH("(blank)",C2:C$12,0)-1))))

  7. #7
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Re: Count unique values until particular value encountered

    Worked perfectly, thanks Tony.

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

    Re: Count unique values until particular value encountered

    You're welcome. Thanks for the feedback!

  9. #9
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Re: Count unique values until particular value encountered

    Upon further investigation I started to find points in the column that aren't giving whole number values. I'm looking for some pattern or explanation as to why this might be, but so far I'm coming up empty. Any ideas why that might be would be appreciated.
    Last edited by rcwagner; 07-01-2016 at 08:12 PM.

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

    Re: Count unique values until particular value encountered

    Can you post an example where that happens?

  11. #11
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Re: Count unique values until particular value encountered

    It turns out that it occurred when the value was encountered. I changed to "none" and I'm getting the numbers I was looking for. I am still curious why that was happening though.

  12. #12
    Registered User
    Join Date
    07-01-2016
    Location
    Madison,WI
    MS-Off Ver
    2013
    Posts
    7

    Re: Count unique values until particular value encountered

    It turns out that it occurred when the value "none" surrounded by angle brackets was encountered. I changed it to "none" without the brackets and I'm getting the numbers I was looking for. I am still curious why that was happening though.

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

    Re: Count unique values until particular value encountered

    Glad you got it straightened out!

+ 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: 2
    Last Post: 08-19-2015, 10:22 AM
  2. [SOLVED] Count then Delete Duplicate Values and put count next to now unique value
    By flipjarg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2014, 04:22 PM
  3. [SOLVED] Unique Total Value Count per Unique Lookup Values
    By KnightVision in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-02-2014, 05:03 AM
  4. [SOLVED] Summing appropriate cells if last entry of a unique id is encountered
    By chicity26 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-03-2014, 05:33 PM
  5. [SOLVED] count unique values based on unique values
    By neetu.aggarwal in forum Excel General
    Replies: 13
    Last Post: 10-23-2012, 04:00 AM
  6. [SOLVED] How To Count Unique Values in COL A Subject for each unique value in COL B ??
    By amirtehrani in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-06-2012, 03:00 AM
  7. Replies: 17
    Last Post: 08-24-2009, 08:58 AM

Tags for this Thread

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