+ Reply to Thread
Results 1 to 12 of 12

Sumproduct the answer? Multiple Criteria and Horizontal Summing

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Hi Guys and Gals,

    In the attached what I'm trying to do is sum the total area figures for a particular month per company and product. The data is on sheet 2 and the summary table is on sheet 1 just in case there is any confusion on that front. The only thing I have managed to come up with is to do multiple SUMIFS functions and add them together. This seems a messy way to go about doing this and I feel there must be a better method of doing this hence why I'm posting here and hoping you'll be able to help or point me in the right direction as I'm stumped. I've tried using SUMPRODUCT but to no avail, maybe I'm doing it incorrect.

    Appreciate any help you can provide

    Lewn
    Attached Files Attached Files
    Last edited by lewny1983; 04-04-2013 at 01:47 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    I used the following Arrayed formula (enter with CNTRL SHFT ENTER)
    in Sheet1 C3 copied across and down.

    =SUM(OFFSET(INDEX(TableA, MATCH($A3&$B3, Sheet2!$A$3:$A$6&Sheet2!$B$3:$B$6,0),MATCH(D$2,Sheet2!$C$1:$J$1,0)),0,0,1,4))

    I named the data (C3:J6) "TableA"
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    ChemistB this worked a treat, thank you for the quick response. I understand the majority of the formula you have stated I just wanted to confirm the 4 used in the offset is the width of the quantity of sales area that are stated for the month?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    That is correct. Glad it worked for you.

  5. #5
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Unfortuantely I've come across a snag as the data I'm actually using sometimes has the same company and product stated twice so they need to be summed together to give the total. Is there anyway to alter the formula to take this into account?

  6. #6
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    With the help of some research found the solution to my problem.

    If any use to anyone the formula is below

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


    Remember to press CTRL+Shift+Enter as it's an array

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    If that formula works, then so should this normal non-array formula:

    =SUMIFS(Sheet2!$C$3:$F$8, Sheet2!$A$3:$A$8, $A3, Sheet2!$B$3:$B$8, $B3)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  8. #8
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Quote Originally Posted by JBeaucaire View Post
    If that formula works, then so should this normal non-array formula:

    =SUMIFS(Sheet2!$C$3:$F$8, Sheet2!$A$3:$A$8, $A3, Sheet2!$B$3:$B$8, $B3)
    When trying this method a #value! is always returned??

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Hm, I just noticed the sum range is bigger than the search ranges. Ok, a normal SUMPRODUCT will work fine with just a small correction to the raw data. I've added January/February flags for each Sheet2 column, now a normal sumproduct works fine:


    =SUMPRODUCT((Sheet2!$A$3:$A$6=$A3)*(Sheet2!$B$3:$B$6=$B3)*(Sheet2!$C$1:$J$1=C$2)*Sheet2!$C$3:$J$6)
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Quote Originally Posted by JBeaucaire View Post
    Hm, I just noticed the sum range is bigger than the search ranges. Ok, a normal SUMPRODUCT will work fine with just a small correction to the raw data. I've added January/February flags for each Sheet2 column, now a normal sumproduct works fine:


    =SUMPRODUCT((Sheet2!$A$3:$A$6=$A3)*(Sheet2!$B$3:$B$6=$B3)*(Sheet2!$C$1:$J$1=C$2)*Sheet2!$C$3:$J$6)
    Is this formula a more efficient way of doing this calculation than the one I previously posted would you say?
    Last edited by lewny1983; 04-04-2013 at 04:12 PM.

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,604

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Quote Originally Posted by lewny1983 View Post
    Is this formula a more efficient way of doing this calculation than the one I previously posted would you say?
    With such small ranges I doubt if you would be able to detect a difference in speed between the two.

    Pete

  12. #12
    Registered User
    Join Date
    08-22-2012
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 ProPlus
    Posts
    27

    Re: Sumproduct the answer? Multiple Criteria and Horizontal Summing

    Thanks for the alternate formula JBeaucaire and thanks for the advice Pete_UK

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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