+ Reply to Thread
Results 1 to 11 of 11

SUMPRODUCT to lookup based on multiple criteria - how does it work?

  1. #1
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    SUMPRODUCT to lookup based on multiple criteria - how does it work?

    Hi,

    I have a formula =SUMPRODUCT((range1=criterion1)*(range2=criterion2)*(data range)) that performs a lookup in a data range subject to two criteria.

    This formula returns the correct answer but could someone please explain how it works?

    Thanks!
    Last edited by andrewc; 11-22-2013 at 11:57 AM.

  2. #2
    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: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    Best site for any query-question about SUMPRODUCT is Bob's Phillips site.
    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.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    read here ,scroll down to "sumproduct explained"
    http://www.xldynamic.com/source/xld.SUMPRODUCT.html
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    range1 is compared to criterion1 and builds an array of TRUE/FALSE values
    ditto range2 and criterion2
    These are multiplied together to create an array of 1/0 values
    This array is multipled by the values range, data range, to build an array of values that meet the criteria (where the two previous tests were TRUE) and zeros
    Sumporiduct then sums this array.

    For a more detailed, far more detailed, explanation, see http://www.xldynamic.com/source/xld.sumproduct.html

  5. #5
    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: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    Nice to see you back here Bob!

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    Thanks. I have been busy, but it is quieter now.

    It is good to get back into the swing

    I know it is still difficult in your homeland, but hopefully things are on the up there, however slowly.

  7. #7
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    Thanks for the quick response! The article you that referred me to is very helpful.

    Can I please ask one more question related to this.

    In the attached file I have used the SUMPRODUCT function both to add and count the values in column C that meet the criteria to be product AAA sold in NYC. Can someone please tell me how I adjust the formula so that I can perform a lookup using these criteria? I appreciate that there is more than one instance that meets the criteria so I would expect the lookup to return the first value it finds in column C, ie. 4.

    Thanks!
    Attached Files Attached Files

  8. #8
    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: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    If the teacher is online, then he is the boss on this!


    Edit: We need many years for this Bob. Thanks for your kind comment.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    for the match
    =INDEX(C2:C7,MATCH("aaa"&"-"&"nyc",INDEX(A2:A7&"-"&B2:B7,0),0))
    but fyi you dont need sum product in excel 2010
    =SUMIFS($C$2:$C$7,$A$2:$A$7,"aaa",$B$2:$B$7,"nyc")
    =COUNTIFS($A$2:$A$7,"aaa",$B$2:$B$7,"nyc")

  10. #10
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    Thank you all!

  11. #11
    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: SUMPRODUCT to lookup based on multiple criteria - how does it work?

    You are welcome-from all of us-- and thanks for the feedback.

+ 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] Need to use either COUNTIFS or SUMPRODUCT to count rows based on multiple criteria
    By erabinov in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2013, 03:15 PM
  2. Replies: 10
    Last Post: 06-28-2012, 08:59 AM
  3. Sumproduct based on multiple criteria
    By TJM in forum Excel General
    Replies: 3
    Last Post: 09-07-2011, 09:51 PM
  4. Replies: 11
    Last Post: 12-07-2010, 04:28 PM
  5. Lookup with multiple criteria...sumproduct error
    By kmlloyd in forum Excel General
    Replies: 2
    Last Post: 01-26-2010, 05:21 PM

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