+ Reply to Thread
Results 1 to 7 of 7

sum product if three fields are true

Hybrid View

00Able sum product if three fields... 01-12-2011, 06:29 PM
martindwilson Re: sum product if three... 01-12-2011, 06:31 PM
00Able Re: sum product if three... 01-12-2011, 06:44 PM
DonkeyOte Re: sum product if three... 01-12-2011, 07:05 PM
00Able Re: sum product if three... 01-12-2011, 07:25 PM
DonkeyOte Re: sum product if three... 01-12-2011, 07:36 PM
day92 Re: sum product if three... 01-12-2011, 07:12 PM
  1. #1
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    sum product if three fields are true

    Heres a Multi criteria sum product Statement, I have an error log and a production sheet.
    What I want is if the error log reports an error, I want it to return the error to the production log for the correct date to the production sheet matching the Line and Zones, So basically it would be count if, the Lines are = and the Zones are = and the Dates are =.

    Each Row in Sheet 2 is one error, so if Columns "Date" & "Line" & "Zone" in sheet Errors = Columns "Date" & "Line" & "Zone" in sheet Production, then it should count each item and add them in Column H in the Production Sheet. I hope this makes sense, all I want is the total amount of errors for each zone and line to automatically calculate, based on what is inputted into the Error Sheet.

    I am trying to use this code, but it seems like it is only working in the first Zone on each Line (probably because the Line cells are merged), any ideas how to fix this without renaming the Line or hiding a row with the names in each cell???

    {=SUM((Errors!$A:$A=Production!$B6)*(Errors!$B:$B=Production!C$2)*(Errors!$I:$I=Production!C$3))}
    For illustrative purposes I have included an attachment, with both sheets and a sample of what it should look like, also in the production sheet I highlighted where values should be for a better visual...
    Last edited by 00Able; 01-12-2011 at 07:30 PM.
    Providing Problems for Your Solutions
    STARS are my Punching Bag, You will be rewarded.

    In the rare event that I may help you, feel free to make me see STARS

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

    Re: sum product if three fields are true

    what verion of excel will you be using?
    "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

  3. #3
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: sum product if three fields are true

    it will be going to 2003, but would love to know how to do it in 2010 also

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

    Re: sum product if three fields are true

    Given the size of the matrix - pre XL2007 you should really add a key to Errors sheet, eg:

    Errors!L2:
    ="@"&A2&"@"&B2&"@"&I2&"@"
    copied down for all rows
    You can then use COUNTIF which is efficient whereas your alternatives are not.

    Production!C6
    =COUNTIF(Errors!$L:$L,"@"&$B6&"@"&LOOKUP(REPT("Z",255),$C$2:C$2)&"@"&C$3&"@")
    applied to matrices
    In XL2010 (as in XL2007) you could use COUNTIFS to negate need for Key

    Without the key you are left with Arrays and/or SUMPRODUCT which are inefficient and should not be used in large quantity (as would be the case here) - assuming performance is of interest.

  5. #5
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: sum product if three fields are true

    Thanks for your assistance day92, appreciate it.


    Quote Originally Posted by DonkeyOte View Post
    Without the key you are left with Arrays and/or SUMPRODUCT which are inefficient and should not be used in large quantity (as would be the case here) - assuming performance is of interest.
    You really are a smart cookie, I aspire to pick up this knowledge...performance is always of interest and I am afraid that is one aspect that I do not fully understand...volatile excel functions...someday I'm hoping I will
    Last edited by 00Able; 01-12-2011 at 07:29 PM.

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

    Re: sum product if three fields are true

    Quote Originally Posted by 00Able
    I aspire to pick up this knowledge
    I'd draw your attention to the below:

    Quote Originally Posted by Rita Mae Brown
    Good judgment comes from experience, and often experience comes from bad judgment
    That's how most people learn that SUMPRODUCTs & Arrays are bad news when used in large quantity and/or with large precedent ranges and/or in Volatile manner.

    Quote Originally Posted by 00Able
    performance is always of interest and I am afraid that is one aspect that I do not fully understand...volatile excel functions...someday I'm hoping I will
    Check out the Volatility link in my sig. - and in fact read through the whole site in full - it's the best resource on Excel performance & optimisation re: calculation engine etc...
    (the author Charles Williams is an MS Excel MVP and has written white papers for them on the same subject - covering a lot of the same material)

  7. #7
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: sum product if three fields are true

    I updated your spreadsheet, let me know is this works for you..
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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