+ Reply to Thread
Results 1 to 4 of 4

Sumproduct

  1. #1
    Registered User
    Join Date
    08-20-2010
    Location
    Excel 2003
    MS-Off Ver
    Excel 2003
    Posts
    2

    Sumproduct

    Can't seem to get this to return correct results. Viewed a few other threads and thought the advice would help but didn't so as a novice excel person, I thought I'd ask for help from the pros. Basically I need to sum the values from one column if the criteria in two other columns are met. Here is what I've tried before.

    =SUMPRODUCT(('Detail page 1'!B1:B65456="UPS GROUND")*('Detail page 1'!Q1:Q65456="P")*('Detail page 1'!P2:P65456))

    =SUMPRODUCT(--('Detail page 1'!B1:B65456="UPS GROUND"),--('Detail page 1'!Q1:Q65456="P"),--('Detail page 1'!P2:P65456))

    =SUMPRODUCT(--('Detail page 1'!B1:B65456="UPS GROUND"),--('Detail page 1'!Q1:Q65456="P"),'Detail page 1'!P2:P65456)
    Last edited by JonathanBurrs; 08-20-2010 at 11:08 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sumproduct

    You don't really state what the exact problem is though the final range is a different size to the previous ranges.

    Given this fact the first formula will return #N/A whereas the latter two will return #VALUE! given use of double unary.

    If you have headers in row 1 then commence ranges from row 2 or use the 3rd approach but change the final range such that it commences from row 1.

    Whenever you use SUMPRODUCT keep ranges to a minimum - it's a very inefficient formula - if you have that much data you should concatenate B and Q into a single string and use a SUMIF approach.

  3. #3
    Registered User
    Join Date
    08-20-2010
    Location
    Excel 2003
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Sumproduct

    Quote Originally Posted by DonkeyOte View Post
    You don't really state what the exact problem is though the final range is a different size to the previous ranges.

    Given this fact the first formula will return #N/A whereas the latter two will return #VALUE! given use of double unary.

    If you have headers in row 1 then commence ranges from row 2 or use the 3rd approach but change the final range such that it commences from row 1.

    Whenever you use SUMPRODUCT keep ranges to a minimum - it's a very inefficient formula - if you have that much data you should concatenate B and Q into a single string and use a SUMIF approach.
    Thanks that solved it.

    =SUMPRODUCT(--('Detail page 1'!B2:B65456="UPS GROUND"),--('Detail page 1'!Q2:Q65456="P"),'Detail page 1'!P2:P65456)

    I was under the impression the headers were relevant to the column being calculated, not the criteria columns. I used the same criteria for the CountIf formulas and they worked fine. Guess that's just one of those things vary from function to function. Again, thanks.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sumproduct

    If you use the above method then you can include the header row without issue... but double unary approach means each array must identical in terms of dimensions

    If you use the multiplication method (which does not nec. have this requirement) then it follows given the explicit coercion taking place your summation range should not include non-numerics.

    Basic example:

    =SUMPRODUCT(--({TRUE,FALSE,TRUE}),--({TRUE,TRUE,TRUE}),{"a",1,2}) -> 2

    the "a" in the summation range will be ignored in similar vein to a SUMIF ignoring non-numerics in sum_range (no explicit coercion taking place)

    Conversely

    =SUMPRODUCT({TRUE,FALSE,TRUE}*{TRUE,TRUE,TRUE}*{"a",1,2}) -> #VALUE!

    the "a" here causes an issue as it's explicitly coerced given * - hence 1*"a" -> #VALUE!

    For more info. on SUMPRODUCT see Bob Phillips' white paper: http://www.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)

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