+ Reply to Thread
Results 1 to 9 of 9

Count occurrences of unique values in a column in comparison with another column input

  1. #1
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    126

    Count occurrences of unique values in a column in comparison with another column input

    Hi,

    I am looking for the Count of occurrences of unique values in column B in comparison with input selected from column A.
    I have used the sumproduct Frequency formula to caluculate the unique values from one column. Please enhance for a selected value from column A.

    Attached file for the need. Please advice

    Thanks
    Attached Files Attached Files
    Shan

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Count occurrences of unique values in a column in comparison with another column input

    Hi santanuKD

    Try the following array formula in F10, to commit the formula, CTRL + SHIFT + ENTER.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

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

    Re: Count occurrences of unique values in a column in comparison with another column input

    Here's another one...

    Array entered**:

    =SUM(IF(FREQUENCY(IF(A2:A15=E10,MATCH(B2:B15,B2:B15,0)),ROW(B2:B15)-ROW(B2)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    126

    Re: Count occurrences of unique values in a column in comparison with another column input

    Hey Kevin,

    Somehow it did not work when I give Level 3 in the selection. Please have a look.

    Thanks,
    Santanu

  5. #5
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    126

    Re: Count occurrences of unique values in a column in comparison with another column input

    Unique Counts - Sumproduct_v1.1.xlsxDear Tony, Kevin,

    if we have one more filter to be added, meaning based on the combination from column a & b the unique count from column c should be displayed.
    Please have a look at the attached excel.

    Thanks,
    Shan

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Count occurrences of unique values in a column in comparison with another column input

    Does this ARRAY formula works for you?

    =SUM(IF((A2:A15=F21)*(B2:B15=G21),1/COUNTIFS(A2:A15,F21,B2:B15,G21,C2:C15,C2:C15)),0)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

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

    Re: Count occurrences of unique values in a column in comparison with another column input

    Try this array formula**:

    =SUM(IF(FREQUENCY(IF(A2:A15=F21,IF(B2:B15=G21,MATCH(C2:C15,C2:C15,0))),ROW(C2:C15)-ROW(C2)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  8. #8
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Count occurrences of unique values in a column in comparison with another column input

    Hi santanuKD

    Try the following array formula H21 (CSE to commit).

    =SUM(SIGN(FREQUENCY(IF((A2:A15=F21)*(B2:B15=G21),MATCH(C2:C15,C2:C15,0)),ROW(2:15)-ROW(1:1))))

  9. #9
    Forum Contributor
    Join Date
    06-12-2009
    Location
    Banglore
    MS-Off Ver
    Excel 2007
    Posts
    126

    Re: Count occurrences of unique values in a column in comparison with another column input

    Dear All,

    All the above mentioned formulas works well. This indeed helps. The below would be nice to have. Please suggest.

    Problem: The excel I am using for this has 35000 rows of data with multiple columns. Hence any action I perform the excel gets hang for say 8-10 mins and I could not do any other thing. This is because of the calculation time that takes for the above formula which searches through 35000. Is there a way to come out of this issue. Can we achieve the same using macro or pivot?

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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