+ Reply to Thread
Results 1 to 6 of 6

Count Unique Occurrences in one column based on criteria another column

Hybrid View

  1. #1
    Registered User
    Join Date
    06-21-2011
    Location
    Belize City, Belize
    MS-Off Ver
    Excel 2007
    Posts
    20

    Count Unique Occurrences in one column based on criteria another column

    Hi

    I want to do a count of unique occurrences of data in one column based on criteria in another column.

    I have attached a sample worksheet with the data. I want to get the result in cell I26.

    Thanks.

    ltsolis
    Attached Files Attached Files
    Last edited by ltsolis; 09-18-2011 at 10:45 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique Occurrences in one column based on criteria another column

    Try:

    =COUNT(1/FREQUENCY(IF(RFPDataTable[Join Month]=3,IF(RFPDataTable[ID]<>"",MATCH(RFPDataTable[ID],RFPDataTable[ID],0))),ROW(RFPDataTable[ID])-MIN(ROW(RFPDataTable[ID]))+1))
    confirmed with CTRL+SHIFT+ENTER not just ENTER
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: Count Unique Occurrences in one column based on criteria another column

    This array formula in I26:

    =COUNT(1/FREQUENCY(IF(I2:I18<>"",IF(MONTH(B2:B18)=3,MATCH(I2:I18,I2:I18,0))),ROW(I2:I18)-ROW(I2)+1))

    ...confirmed with CTRL-SHIFT-ENTER to activate the array. Result should be 5.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    06-21-2011
    Location
    Belize City, Belize
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Count Unique Occurrences in one column based on criteria another column

    Wow...both formulas worked perfectly, and looks just about the same. Thank you very much.

    I have another puzzle that I could use your assistance on. It's related to the unique counting, but adds a twist.

    I have added a new column with some numbers to the table. I want to sum (in J28) the numbers but only the single instance of the number as determined by the unique occurrence of the ID. Each ID has a number associated with it, and is repeated the same amount of times as the ID, but I want to sum only one of each instance.

    Your help would be greatly appreciated.

    Please let me know if I need to do a new thread.

    ltsolis
    Attached Files Attached Files

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Unique Occurrences in one column based on criteria another column

    If you are still including the criteria of Month=3, try:

    =SUM(IF(FREQUENCY(IF(RFPDataTable[Join Month]=3,IF(RFPDataTable[ID]<>"",MATCH(RFPDataTable[ID]&RFPDataTable[Number],RFPDataTable[ID]&RFPDataTable[Number],0))),ROW(RFPDataTable[ID])-MIN(ROW(RFPDataTable[ID]))+1),RFPDataTable[Number]))
    else if you are only looking for unique ID/Number combinations try:

    =SUM(IF(FREQUENCY(IF(RFPDataTable[ID]<>"",MATCH(RFPDataTable[ID]&RFPDataTable[Number],RFPDataTable[ID]&RFPDataTable[Number],0)),ROW(RFPDataTable[ID])-MIN(ROW(RFPDataTable[ID]))+1),RFPDataTable[Number]))
    either is CSE confirmed.

  6. #6
    Registered User
    Join Date
    06-21-2011
    Location
    Belize City, Belize
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Count Unique Occurrences in one column based on criteria another column

    Works perfectly...thank you very much.

    ltsolis

+ 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