+ Reply to Thread
Results 1 to 10 of 10

Sumproduct on multiple criteria

  1. #1
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Sumproduct on multiple criteria

    Hi

    Apologies if someone has answered this before but I think it's something simple but isn't working for me.

    I have three columns of data (scores like 1.2, 4.3, 0, 5.6 etc. etc.) in each of the columns B,C,D on sheet 2. (Column A has the Candidate Name).

    I am doing a count of the number of scores that are greater than 1 in columns B and C or D.

    I can do the count of the number of scores that are greater than 1 in columns B and C using the code below and I think it's working correctly. However I need to check Column B score with Column C OR D ie. a count of the number that are getting a score of >1 in column B AND >1 in (column C OR D) .... ie if someone scored >1 in column B but <1 in column C but >1 in column D, then they would include in the count (or vice versa for columns C/D).

    Please Login or Register  to view this content.
    I tried adding AND(OR( to the sumproduct but it's not quite working right.

    Can anyone help?

    Thanks

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,987

    Re: Sumproduct on multiple criteria

    Better to attach the workbook so that we can troubleshoot.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,084

    Re: Sumproduct on multiple criteria

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-17-2019
    Location
    Chennai,India
    MS-Off Ver
    10
    Posts
    1

    Re: Sumproduct on multiple criteria

    can you please attach the screenshot of the table

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,987

    Re: Sumproduct on multiple criteria

    Thanks for your interest, Divinedeba - we don't encourage the use of screenshots, as they are of little practical use. I have already requested a workbook.

  6. #6
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Sumproduct on multiple criteria

    Thanks Fluff13

    That doesn't work as I get an answer of 122 but only have 70 rows(!)

    AliGW - I have attached the file .. thanks for your help in advance.
    Attached Files Attached Files

  7. #7
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Sumproduct on multiple criteria

    you need to either do a >0 test on the OR -- or, simpler still, wrap the OR (+) within a SIGN to enforce 0-1 result as opposed to 0-2

    =SUMPRODUCT((Sheet2!$B$2:$B$70>=1)*SIGN((Sheet2!$C$2:$C$70>=1)+(Sheet2!$D$2:$D$70>=1)))

  8. #8
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Sumproduct on multiple criteria

    Do you mean

    Please Login or Register  to view this content.
    ??

    I still don't get the correct answer with this I think
    Last edited by technik; 07-17-2019 at 12:21 PM.

  9. #9
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Sumproduct on multiple criteria

    No, my prior post contains the correct syntax.

    In SUMPRODUCTs, like a CSE Array, ORs are conducted by means of Addition - ANDs are conducted via multiplication, e.g.

    (test1)+(test2) is an OR

    (test1)*(test2) is an AND

    the issue with the OR syntax is, unless mutually exclusive tests, is that you can over count - i.e. your OR could return 2 if both tests returned True

    to negate the over counting, ie. to prevent 2, you can apply either a SIGN call (0 for 0, 1 for >0)

    SIGN((test1)+(test2))

    or you could do a >0 test

    (((test1)+(test2))>0)

    IMO the SIGN approach is always simpler, syntax wise.
    Last edited by XLent; 07-17-2019 at 12:31 PM.

  10. #10
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Sumproduct on multiple criteria

    Thanks XLent - think that's done the trick.

    Much appreciated. Love the SIGN approach and didn't know it even existed.

+ 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. Combine sumif/sumproduct or sumproduct with multiple criteria
    By sab128 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2018, 08:25 AM
  2. [SOLVED] Sum based on multiple criteria using sumproduct: One criteria is 'cell contains'.....
    By jeroenv in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-04-2018, 08:18 AM
  3. [SOLVED] SUMPRODUCT of multiple columns with multiple criteria over multiple sheets
    By BellyGas in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2015, 08:27 AM
  4. [SOLVED] Multiple criteria SUMPRODUCT (3 criteria) Excel 2003
    By lelrich in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-10-2014, 01:58 PM
  5. Replies: 6
    Last Post: 08-04-2013, 11:53 AM
  6. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  7. Sumproduct/sumif/indirect across multiple workbooks, worksheets, multiple criteria
    By robgardner15 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2011, 02:35 AM

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