+ Reply to Thread
Results 1 to 7 of 7

Total number of unique matches in two columns

  1. #1
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Total number of unique matches in two columns

    Column A = numerical IDs, multiple entries, may have duplicates that should only be counted once in comparison
    Column B = numerical IDs, multiple entries, may have duplicates that should only be counted once in comparison

    Need: 1 cell that compares all of the A range to all of the B range and returns a a percentage of repeats. So, if there are 50 entries in A, and only 40 are unique, and B includes 10 repeats (unique, not multiple), then the returned value would be 25%.
    Last edited by JBeaucaire; 11-13-2008 at 07:43 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Sample posted.
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    One of the few formulae I can remember:

    =SUM(N(FREQUENCY(B2:B8,B2:B8)>0))/SUM(N(FREQUENCY(A2:A11,A2:A11)>0))

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Quote Originally Posted by StephenR View Post
    One of the few formulae I can remember:

    =SUM(N(FREQUENCY(B2:B8,B2:B8)>0))/SUM(N(FREQUENCY(A2:A11,A2:A11)>0))
    Duh...your formula works for what I posted...which was wrong. Look again. I need to figure out how many REPEATED unique numbers occur and percent that against the original unique numbers list.
    Attached Files Attached Files
    Last edited by JBeaucaire; 11-11-2008 at 08:56 AM. Reason: Corrected worksheet

  5. #5
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    If I understand you correctly, the number in B19 is arrived at by counting the number of times a number in B2:B8 occurs more than once and where the number occurs in A2:A11. Is this correct?
    Last edited by Domenic; 11-11-2008 at 10:38 AM. Reason: Clarification...

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Quote Originally Posted by Domenic View Post
    If I understand you correctly, the number in B19 is arrived at by counting the number of times a number in B2:B8 occurs more than once and where the number occurs in A2:A11. Is this correct?
    The list in A only has 7 unique numbers in it. I don't need to know how many times a number occurs, just how many unique numbers are there. The real list could be longer or shorter each month.

    Then, in B, I find only 5 unique entries. Again, the REAL list could be of any length.

    Then I need to find how many of the unique entries in B also occur in A. I can express that as a percentage, I just need to know if that can be calculated in a single cell?

  7. #7
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Based on the sample data, it looks that B2:B8 contains 5 unique ID's (33, 42, 45, 54, and 66). However, it looks like only 3 of these unique ID's occur in A2:A8 (33, 45, and 54). If this is correct, try...

    D2, confirmed with CONTROL+SHIFT+ENTER:

    =SUM(IF(ISNUMBER(MATCH(IF(FREQUENCY(IF(B2:B8<>"",MATCH("~"&B2:B8,B2:B8&"",0)),ROW(B2:B8)-ROW(B2)+1)>0,B2:B8),A2:A11,0)),1))

    E2, confirmed with CONTROL+SHIFT+ENTER:

    =SUM(IF(FREQUENCY(IF(A2:A11<>"",MATCH("~"&A2:A11,A2:A11&"",0)),ROW(A2:A11)-ROW(A2)+1)>0,1))

    F2:

    =D2/E2

    Hope this helps!

+ 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