+ Reply to Thread
Results 1 to 11 of 11

sumproduct with different array sizes

  1. #1
    Registered User
    Join Date
    09-19-2015
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    3

    sumproduct with different array sizes

    hi, I am trying to figure out a way of using sumproduct with mulitple criteria to return the sum of values within a set of columns. Attached is the example.

    Column A = contains values for criteria 1
    column B = contains values for criteria 2
    columns C - H inclusive = contains values for months 1 - 6



    based upon a particular month (range name "include"), i want to be able to get the YTD results based upon the criterias i set.

    i have been trying

    =SUMPRODUCT(--(A2:A10="A"),--(B2:B10=6),OFFSET(C2,0,0,,include))

    and
    =SUMPRODUCT(--(A2:A10="A"),--(B2:B10=6),sum(OFFSET(C2,0,0,,include)))

    but it seems i keep running into issues with the different array size in columns C-H. i guess i need to somehow get it down to one column some how so that sumproduct can do its magic.

    any ideas?Test.xlsx

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: sumproduct with different array sizes

    Not sure if I follow exactly what you want, see if this works.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Result shows 0 on your test because no row meets the criteria of "A" and 6.

  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: sumproduct with different array sizes

    Here's another one...

    =SUMPRODUCT((A2:A10="A")*(B2:B10=6)*C2:INDEX(C2:H10,0,include))

    The result is currently 0 as the criteria in columns A and B are not met.
    Last edited by Tony Valko; 09-19-2015 at 03:16 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    09-19-2015
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    3

    Re: sumproduct with different array sizes

    that did it....i don't understand why it work with * but not with --, ....need to read up on this one. thanks

  5. #5
    Registered User
    Join Date
    09-19-2015
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    3

    Re: sumproduct with different array sizes

    thanks. seems to be the big difference is using the * instead of --,...need to read about this.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: sumproduct with different array sizes

    Or this 1 (just to fix your formula)...
    =SUMPRODUCT((A2:A10="A")*(B2:B10=6)*OFFSET(C2,0,0,9,include))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: sumproduct with different array sizes

    Quote Originally Posted by FDibbins View Post
    Or this 1 (just to fix your formula)...
    Already done that way back in post #2.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: sumproduct with different array sizes

    Quote Originally Posted by jason.b75 View Post
    Already done that way back in post #2.
    Not quite the same.
    Yours...
    =SUMPRODUCT((A2:A10="A")*(B2:B10=6)*OFFSET(C2:C10,0,0,,include))
    Mine...
    =SUMPRODUCT((A2:A10="A")*(B2:B10=6)*OFFSET(C2,0,0,9,include))


    You wont necessarily know to go down to C10, but the 9 can be calc'd with something like this, to make it more dynamic...
    =SUMPRODUCT((A2:A10="A")*(B2:B10=6)*OFFSET(C2,0,0,COUNTA(A:A)-1,include))
    Last edited by FDibbins; 09-19-2015 at 04:32 PM.

  9. #9
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: sumproduct with different array sizes

    I was wondering if you read mine as

    =SUMPRODUCT((A2:A10="A")*(B2:B10=6)*OFFSET(C2,0,0,,include))

    and thought I had only fixed part of it.

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: sumproduct with different array sizes

    In excel, there are often many many ways of doing the same thing, thats what makes it so interesting
    Thanks for the feedback

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

    Re: sumproduct with different array sizes

    Quote Originally Posted by sccheng888 View Post
    thanks. seems to be the big difference is using the * instead of --,...need to read about this.
    See this...

    http://xldynamic.com/source/xld.SUMPRODUCT.html

+ 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] Sumproduct with Arrays of Different Sizes
    By jglassmanba in forum Excel General
    Replies: 11
    Last Post: 06-09-2021, 11:31 PM
  2. Matching a column of shaft sizes to a column of hole sizes to find best match for all
    By BrettRCourtney in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-09-2013, 11:25 AM
  3. Larger sizes against smaller sizes
    By nathanocs in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-13-2013, 04:41 PM
  4. sumproduct of a number array and a text array starting with 2 numbers
    By Bishonen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-21-2013, 11:48 AM
  5. Need Help sumproduct? array?
    By jcinthecity in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2013, 04:35 PM
  6. [SOLVED] SUMPRODUCT - between two worksheets and two different array sizes
    By Lacaycer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-11-2012, 10:13 AM
  7. [SOLVED] Sumproduct - 2 criteria with different array sizes
    By Lacaycer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-03-2012, 02:24 PM
  8. Excel 2007 : Copy different array sizes?
    By Murellus in forum Excel General
    Replies: 0
    Last Post: 02-03-2012, 06:59 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