+ Reply to Thread
Results 1 to 9 of 9

SUMPRODUCT Multiple Criteria with Distinct Values

  1. #1
    Registered User
    Join Date
    01-13-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel O365 Enterprise
    Posts
    10

    Question SUMPRODUCT Multiple Criteria with Distinct Values

    Hi everyone, I am hoping to get some assistance with a SUMPRODUCT formula with multiple criteria.

    In the attached example s/sheet I am trying to count the number of distinct ‘Tests’ in column B (= 8) that also meets the adjacent ‘Result’ criteria (= Result 1), in column C (answer = 7 which I have manually counted to illustrate the requirement).

    The independent components of my formula seem to work:
    • Counting distinct Values only (case insensitive) in column B
    • Counting Test results that = “Result 1” in column C

    I need help with combining the formula.

    Thanks in advance,
    KJ
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    01-13-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel O365 Enterprise
    Posts
    10

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    Draft formula:

    =SUMPRODUCT((--EXACT(C3,C6:C18)),(--(B6:B18<>""))/COUNTIF(B6:B18,B6:B18&"")+0)

  3. #3
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,829

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    Since you are using 365, can you use this formula instead of SUMPRODUCT?

    =COUNTA(UNIQUE(FILTER($B$6:$C$18,$C$6:$C$18=$C$3)))/2

  4. #4
    Registered User
    Join Date
    01-13-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel O365 Enterprise
    Posts
    10

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    Quote Originally Posted by Gregb11 View Post
    Since you are using 365, can you use this formula instead of SUMPRODUCT?

    =COUNTA(UNIQUE(FILTER($B$6:$C$18,$C$6:$C$18=$C$3)))/2
    Thanks for this! In this instance I am actually having to use Office 2016 and I can't get the above to function.

    I am also using this within the context of a SUBTOTAL/OFFSET to calculate for visible cells only (based on some other filtering required), therefore, I will need to use a SUMPRODUCT which currently looks like this:

    =SUMPRODUCT(SUBTOTAL(3,OFFSET(C6:C18,ROW(C6:C18)-MIN(ROW(C6:C18)),,1)),(--EXACT($C$3,C6:C18)),(--(B6:B18<>""))/COUNTIF(B6:B18,B6:B18&"")+0)

    Please let me know,
    KJ

  5. #5
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    f5=SUM(IF(FREQUENCY(IF($C$6:$C$18=C3,MATCH(B6:B18,B6:B18,0)),ROW(B6:B18)-ROW(B6)+1),1))

    control+shift+enter
    Last edited by CARACALLA; 02-11-2021 at 01:27 AM.

  6. #6
    Registered User
    Join Date
    01-13-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel O365 Enterprise
    Posts
    10

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    Quote Originally Posted by CARACALLA View Post
    f5=SUM(IF(FREQUENCY(IF($C$6:$C$18=C3,MATCH(B6:B18,B6:B18,0)),ROW(B6:B18)-ROW(B6)+1),1))

    control+shift+enter
    Thanks, this appears to work in isolation, but I am hoping to build into a SUMPRODUCT to maintain the ability to calculate for visible cells only - is there a way to combine this in to a SUMPRODUCT?

  7. #7
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    F5=sum(if(frequency(if(subtotal(3,offset(b6,row(b6:b18)-row(b6),,1)),if(c6:c18=c3,match(b6:b18,b6:b18,0))),row(b6:b18)-row(b6)+1),1))

  8. #8
    Registered User
    Join Date
    01-13-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel O365 Enterprise
    Posts
    10

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    Quote Originally Posted by CARACALLA View Post
    F5=sum(if(frequency(if(subtotal(3,offset(b6,row(b6:b18)-row(b6),,1)),if(c6:c18=c3,match(b6:b18,b6:b18,0))),row(b6:b18)-row(b6)+1),1))
    Thanks so much, this is great! I have added Reputation

    However, I haven't used this method before for these types of counts so unsure how to add more variables, whereas I am more familiar with a SUMPRODUCT.

    I am also trying to avoid array formula's where possible, do you think this is possible to do in a SUMPRODUCT?

    Alternatively, is there an explanation for how I can easily add extra variables to this formula? I have attached an updated s/sheet (v2) with the subsequent variables I am trying to add in to the formula.

    Thanks again for the help here!
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: SUMPRODUCT Multiple Criteria with Distinct Values

    H5=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(B6,ROW(B6:B18)-ROW(B6),,1)),IF(C6:C18=C3,MATCH(B6:B18,B6:B18,0))),ROW(B6:B18)-ROW(B6)+1),1))

    Control+shift+enter



    K5=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(B6,ROW(B6:B18)-ROW(B6),,1)),IF(Table1[Results]=C3,IF(Table1[Rating]=D3,MATCH(B6:B18,B6:B18,0)))),ROW(B6:B18)-ROW(B6)+1),1))


    Control+shift+enter


    N5=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(B6,ROW(B6:B18)-ROW(B6),,1)),IF(Table1[Results]=C3,IF(Table1[Rating]=D3,IF(Table1[Expectation]=E3,MATCH(B6:B18,B6:B18,0))))),ROW(B6:B18)-ROW(B6)+1),1))


    Control +shift+enter


    Sorry for my English

    For evry condition one if

    For the Frequency

    ROW (B6: B18) -ROW (B6) +1 bin arry

    data array

    IF (SUBTOTAL (3, OFFSET (B6, ROW (B6: B18) -ROW (B6) ,, 1))), IF (Table1 [Results] = C3, IF (Table1 [Rating] = D3, IF (Table1 [Expectation ] = E3, MATCH (B6: B18, B6: B18,0)))))

+ 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 Distinct Values with Multiple Criteria
    By stacey52891 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2020, 01:19 PM
  2. [SOLVED] get distinct values from criteria AND sum all of the values of the distinct
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-10-2017, 02:57 PM
  3. [SOLVED] SUMPRODUCT values in one column with multiple criteria
    By ettamucci in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-06-2016, 03:21 AM
  4. Sum column and count distinct values in another based on multiple criteria
    By mike.greene in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-12-2015, 11:50 AM
  5. Replies: 5
    Last Post: 03-13-2012, 06:05 AM
  6. Formula to COUNTA distinct values with multiple criteria
    By f0urchette in forum Excel General
    Replies: 4
    Last Post: 02-20-2012, 04:54 AM
  7. SUMPRODUCT with multiple values for criteria?
    By tangcla in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2009, 05:27 AM

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