+ Reply to Thread
Results 1 to 6 of 6

Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

  1. #1
    Registered User
    Join Date
    07-15-2019
    Location
    Sydney, Australia
    MS-Off Ver
    Office365
    Posts
    6

    Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

    Hi All, I'm new here.
    my manager sent me a spreadsheet to play with a formula to include extra criteria. I've never used sumproduct, and my gogglefoo isn't working as I can't wrap my brain around it . I'm more a vlookup girl.

    current formula is:
    =SUMPRODUCT((SUBTOTAL(3,OFFSET($E$16:$E$1619,ROW($E$16:$E$1619)-MIN(ROW($E$16:$E$1619)),,1)))*(($E$16:$E$1619)=$F$4)*(P$16:P$1619))

    wherein
    Column E holds values, e.g. E90, E00, E75 etc.
    $F$4 refers to a cell that lists E90 as a value
    column p contains the sum total of each row

    now I need to add in to also look for E00 in column E but only if a certain value in colum D as E00 has some negative amounts that need to be applied. However, applies to various sectors not just CS wind..

    I've tried below, based on what I could deduce on sumproduct formulas, but somewhere I'm going wrong, and probably missing some brackets.

    =SUMPRODUCT((SUBTOTAL(3,OFFSET($E$16:$E$1619,ROW($E$16:$E$1619)-MIN(ROW($E$16:$E$1619)),,1)))*(($E$16:$E$1619)=$F$4)*($E$16:$E$1619)=$G$4)*(($D$16:$D$1619)=$F$2)*(P$16:P$1619)
    wherein
    Column E holds the first value, E00
    $g$4 refers to a cell that lists E00 as a value
    column D holds the second value
    $F$2 refers to a cell that lists said second value
    column p contains the sum total of each row

    I've also tried with if(or(and but that came totally unravelled

    Any suggestions?

    I have uploaded truncated file (sample.xlsx) as I had to remove sensitive information. the cells highlighted in yellow

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Excel 2007
    Posts
    19,644

    Re: Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

    When you are dealing with arrays, it is important to note that * is equivalent to AND and + is equivalent to OR - you can't use the AND or OR functions as they can only be used on single cells.

    This part of your formula:

    (($E$16:$E$1619)=$F$4)*(($E$16:$E$1619)=$G$4)

    (and you are right: you missed a bracket after the * which I've added in red) is basically saying "(column E cells are equal to F4) AND (column E cells are equal to G4)" which can never be true if F4 is not equal to G4 - I think you need to consider OR (+) here, and put an extra set of brackets at the beginning and end of the expression within your formula. There should also be an extra close bracket at the end of your formula.

    Hope this helps.

    Pete

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    2007, Office 365
    Posts
    11,597

    Re: Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

    Hello KIGeorge. Welcome to the forum.

    I've never used sumproduct, and my gogglefoo isn't working as I can't wrap my brain around it . I'm more a vlookup girl.
    Has your gogglefoo ( LOL) taken you here? http://xldynamic.com/source/xld.SUMPRODUCT.html

    In the meantime I will have a look at the formula you posted above. (Pete beat me to it.)
    Last edited by FlameRetired; 07-15-2019 at 09:47 PM.
    Dave

  4. #4
    Registered User
    Join Date
    07-15-2019
    Location
    Sydney, Australia
    MS-Off Ver
    Office365
    Posts
    6

    Re: Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

    no wonder my head hurt when * = + and + equals or . I definitely have a steep learning curve ahead. In the meantime I played with sumifs and found a (not so elegant but working) solution for the interim.

  5. #5
    Registered User
    Join Date
    07-15-2019
    Location
    Sydney, Australia
    MS-Off Ver
    Office365
    Posts
    6

    Re: Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

    Thanks FlameRetired, I have bookmarked that page!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    41,036

    Re: Sumproduct with multiple variants - Help! I'm a newbie to sumproduct

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

+ 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. Compute Sumproduct while Excluding product Variants
    By Pneumz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-11-2018, 10:55 PM
  2. 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
  3. [SOLVED] Avoiding Variants: Multiple Declarations per Line Assign Variants To All But Last Variable
    By joe31623 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 12-08-2015, 11:35 AM
  4. Count SUMPRODUCT Members / Average of SUMPRODUCT
    By Shingaru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 03:59 PM
  5. Replies: 1
    Last Post: 05-19-2012, 02:54 AM
  6. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  7. Using a SumProduct Count to find a SumProduct Total?
    By XL021710 in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 08:31 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