+ Reply to Thread
Results 1 to 15 of 15

count unique records in one column based on criteria in a different column

  1. #1
    Registered User
    Join Date
    03-03-2014
    Location
    Louisville Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    4

    count unique records in one column based on criteria in a different column

    Hello

    I'm trying to create a macro that will insert another tab that lists each name in column a and then counts the unique records in column b for each name. I've been searching the forums and can't find a solution but that could be because I'm not wording my search correctly. I attached a sample worksheet. The solution should be:

    Jane R Doe - 8
    Susie Q brown - 7
    Bob M Jones - 6
    Tony F Harris - 5

    Any help would be greatly appreciated.

    Thanks,
    Ronna
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: count unique records in one column based on criteria in a different column

    A pivot table seems to be what you need
    See attached
    Attached Files Attached Files
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: count unique records in one column based on criteria in a different column

    I made perhaps a confusion and update the file with an extra formula: just to start
    But still not the right result ...!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-03-2014
    Location
    Louisville Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: count unique records in one column based on criteria in a different column

    I don't think a pivot table would work. I posted a very simple worksheet. My actual worksheet will have 20 additional columns of information that will get broken out into seperate tabs based on the names. I need to make sure I have a certain number of records for each person before I start manipulating the data.

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: count unique records in one column based on criteria in a different column

    Can you comment the results shown.
    Whatever the use of a pivot table the results are not what you sent.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: count unique records in one column based on criteria in a different column

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-03-2014
    Location
    Louisville Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: count unique records in one column based on criteria in a different column

    It looks like what your spreadsheet is doing is counting the number of records in column b that are the same. What I'm looking for is something that will tell me that Jane Doe has 8 unique records in column b, Susie Brown has 7 unique records in column b, etc.
    Thanks for taking the time to look at this.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: count unique records in one column based on criteria in a different column

    Did you check the results on the added sheet? Does it reflect what you show in Post #1 as the required result. If your data is sorted as in your example it should give your a unique count.

  9. #9
    Registered User
    Join Date
    03-03-2014
    Location
    Louisville Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: count unique records in one column based on criteria in a different column

    John Davis,
    That's it, that is exactly what I was looking for. Thank you very much!

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: count unique records in one column based on criteria in a different column

    You're welcome. Glad to help out and thanks for the feedback.

  11. #11
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: count unique records in one column based on criteria in a different column

    If the macro is a must try

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by PCI; 11-18-2014 at 04:29 PM.

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: count unique records in one column based on criteria in a different column

    A remake with same results as shown (finally understood the purpose)
    It could go quickly if there is a lot of data
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    12-17-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    137

    Re: count unique records in one column based on criteria in a different column

    Hi Davis,

    Is this logic will work for 40 Sheets. as per my below example. please Suggest and thanks for your help!

    For Example if I have two sheets, I should not manually enter Sheet 1 and Sheet 2 in the Code it is to be automated in the Code. Can you please help me on this.

    I need to Create Final sheet as in the Third Table.

    In Final Sheet I need to remove the duplicate and show in First Column and Number of FAIL in second Column and Number of PASS in Third Column.

    Please Note that the logic should work automatically even if the Client add a New sheet or delete the Existing Sheet. Please help me on this.

    Shee1

    Table Name Test Case Test Result
    ABC ABC_Test Case 1 PASS
    ABC ABC_Test Case 2 FAIL
    ABC ABC_Test Case 3 FAIL
    XYZ XYZ_Test Case 1 FAIL
    XYZ XYZ_Test Case 2 FAIL
    CDE CDE_Test Case 1 PASS
    CDE CDE_Test Case 2 PASS

    Sheet 2

    Table Name Test Case Test Result
    CCC CCC_Test Case 1 PASS
    CCC CCC_Test Case 2 FAIL
    DDD DDD_Test Case 1 FAIL
    DDD DDD_Test Case 2 PASS
    DDD DDD_Test Case 3 FAIL
    DDD DDD_Test Case 4 FAIL

    Final Sheet Should be created as below

    Table Name COUNT OF FAILS COUNT OF PASS
    ABC 2 1
    XYZ 2 0
    CDE 0 2
    CCC 1 1
    DDD 3 1

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: count unique records in one column based on criteria in a different column

    Deleted..........

    Kandavalli.Kiran,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Last edited by jindon; 01-09-2015 at 09:25 PM.

  15. #15
    Forum Contributor
    Join Date
    12-17-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    137

    Re: count unique records in one column based on criteria in a different column

    Thank you Sooooooooooo.... much!

    It Solved my problem.

+ 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] Count unique entries based off unique criteria in another column
    By hambly in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 06-11-2014, 03:33 PM
  2. Count unique occurrances based off criteria in a different column
    By Enovy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-05-2013, 03:28 PM
  3. Count unique records in a column
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2013, 11:51 AM
  4. [SOLVED] Count Unique Values in Column A that meet criteria in Column B
    By ashakespeare in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-04-2012, 07:33 PM
  5. Replies: 5
    Last Post: 09-18-2011, 10: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