Consulting

Results 1 to 9 of 9

Thread: Count unique values based on multiple criteria

  1. #1

    Count unique values based on multiple criteria

    Hi,

    I've searched numerous forum and have not yet found an answer to my problem. Using a formula, I'd like to count unique occurrences in column A where Column B = a particular string AND Column C = a different string (and eventually Column D = yet another value).

    I've uploaded a spreadsheet that I expanded on from another forum where the solution was the closest I could find. Cells F15, G15, and H15 are my attempt at making this work. After spending several days on this, I feel I'm no closer to a solution than when I started.

    I found how to count occurrences based on the value of colum b and c but not UNIQUE values.

    Any ideas?
    Thanks,
    Bob
    Attached Files Attached Files
    Last edited by Paul_Hossler; 11-08-2019 at 10:15 AM. Reason: Used [Thread Tools] 'SOLVED' instead of Title edit

  2. #2
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    sumproduct! check out the sticky on using the formula
    ------------------------------------------------
    Happy Coding my friends

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    TRy this array formula

    =SUM(IF(FREQUENCY(IF(($A$1:$A$15<>"")*($B$1:$B$15="Active")*($C$1:$C$15="a" ),
    MATCH($A$1:$A$15,$A$1:$A$15,0)),ROW(INDIRECT("1:"&ROWS($A$1:$A$15))))>0,1))

    commit with Ctrl-Shift-Enter
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4

    Thank you both

    I now know more about sumproduct - which will be immensely helpful! And XLD - that formula works beautifully. And thanks to CatDaddy I now know how it works.

  5. #5
    VBAX Regular
    Joined
    Aug 2019
    Location
    Fortaleza
    Posts
    11
    Location
    hi!

    How about having a text partial match as a criteria?
    I've tried ($A$1:$A$30="Venda&*") but no success!

    thanks!


    Quote Originally Posted by xld View Post
    TRy this array formula

    =SUM(IF(FREQUENCY(IF(($A$1:$A$15<>"")*($B$1:$B$15="Active")*($C$1:$C$15="a" ),
    MATCH($A$1:$A$15,$A$1:$A$15,0)),ROW(INDIRECT("1:"&ROWS($A$1:$A$15))))>0,1))

    commit with Ctrl-Shift-Enter

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try

    (Left($A$1:$A$30,5)="Venda")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    PHP Code:
    =SUMPRODUCT(--(LEFT($B$2:$B$15;5)&$C$2:$C$15="Vendaa");1/(COUNTIF($A$2:$A$15;$A$2:$A$15))) 

  8. #8
    VBAX Regular
    Joined
    Aug 2019
    Location
    Fortaleza
    Posts
    11
    Location
    Quote Originally Posted by xld View Post
    Try

    (Left($A$1:$A$30,5)="Venda")
    I'll try the suggestion above! Thank you!

  9. #9
    VBAX Regular
    Joined
    Aug 2019
    Location
    Fortaleza
    Posts
    11
    Location
    Ended using the one I began with and I'm afraid the file is getting too heavy - calculation/processing wise. These matrix formulas are killing it, but we seem to be bumping into one of excel's limitation.
    Thanks a lot for looking into it.

    Cheers,


    Quote Originally Posted by snb View Post
    PHP Code:
    =SUMPRODUCT(--(LEFT($B$2:$B$15;5)&$C$2:$C$15="Vendaa");1/(COUNTIF($A$2:$A$15;$A$2:$A$15))) 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •