+ Reply to Thread
Results 1 to 4 of 4

Count unique values in column B associated with each value in column A

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    8

    Count unique values in column B associated with each value in column A

    Hey,

    I currently have a table with two columns:

    John siteA
    Mike siteA
    John siteC
    Dan siteC
    Mike siteA
    Dan siteC
    Mike siteB
    Mike siteB
    John siteA
    Dan siteC

    I want to create a third column that could list the count of unique sites attributed to each name. The logic would read like this:

    John 2 unique sites
    Mike 2 unique sites
    Dan 1 unique site

    So basically, the final table would look something like this:

    John siteA 2
    Mike siteA 2
    John siteC 2
    Dan siteC 1
    Mike siteA 2
    Dan siteC 1
    Mike siteB 2
    Mike siteB 2
    John siteA 2
    Dan siteC 1

    I currently use an array formula to do this, but having a table of 30K rows, it is incredibly slow (took me 10 minutes to get to about 3%):

    Please Login or Register  to view this content.
    Is there any other formula that would help me do the job faster?

    Cheers

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count unique values in column B associated with each value in column A

    hi alienss, i would normally use somethin similar to your array formula too. but i dont usually have 30K rows. no guarantees, but you can try these:

    COUNTIFS not an array, so i guess it works a little faster
    Please Login or Register  to view this content.
    or SUMPRODUCT, which works faster than an array:
    Please Login or Register  to view this content.
    let me know how it turns out

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    09-28-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Count unique values in column B associated with each value in column A

    Hey benishiryo,

    Tried both of them, but they only seem to count to a maximum of 2. For example, in my initial table, if I add John -> siteB, it doesn't count 3 unique sites, still counts only 2 (but it works if I add Dan -> siteB, cause Dan only had 1 site).

    Any idea why this might be?

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count unique values in column B associated with each value in column A

    ahhh that's cause i only catered for 2. tried to help you search for a non-array formula, but to no avail. would you consider using a helper column?
    place either of this in Column C:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    then in column D:
    =SUMIF($A$1:$A$10,A1,$C$1:$C$10)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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