+ Reply to Thread
Results 1 to 8 of 8

SUMIF with dual criteria?

  1. #1
    Registered User
    Join Date
    11-09-2006
    Posts
    65

    SUMIF with dual criteria?

    I want to use a SUMIF statement that will only sum items that meet 2 criteria that are located within 2 target areas.

    Example:
    column A has date
    column B has part numbers
    column C has cost

    So I want to get a total cost of all of a particilar part number used within a certain date range.

    The SUMIF statement worked perfect for only finding date and cost, but now I want to add a 3rd component into the mix.

    Any experts out there that can help?
    Thanks

  2. #2
    Forum Contributor Kieran's Avatar
    Join Date
    10-02-2003
    Location
    Perth, Western Australia
    MS-Off Ver
    Office 2003
    Posts
    109
    It appers that you will need the SUMPRODUCT function or use array formulas.

    Without a specific example however, I cannot offer any concrete solution.

    Note however that the SUMPRODUCT functionis faster to execute, ARRAY formulas are difficult for beginners but can be very powerful.
    if you want a qick primer go to http://www.emailoffice.com/excel/arrays-bobumlas.html
    Kieran

  3. #3
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by surfengine
    I want to use a SUMIF statement that will only sum items that meet 2 criteria that are located within 2 target areas.

    Example:
    column A has date
    column B has part numbers
    column C has cost

    So I want to get a total cost of all of a particilar part number used within a certain date range.

    The SUMIF statement worked perfect for only finding date and cost, but now I want to add a 3rd component into the mix.

    Any experts out there that can help?
    Thanks
    As Kieran said, SUMPRODUCT is probably the way to go.

    Try something like the following: (I just assumed 15 rows, easily modified)

    =SUMPRODUCT(($A$1:$A$15>=DATEVALUE("10/10/2006"))*($A$1:$A$15<=DATEVALUE("11/03/2006")),--($B$1:$B$15="A101"),$C$1:$C$15)

    The problem with this is that the dates and part number being looked for are in the formula itself. The following formula is better: (The assumption being that the start date is in E1, the end date in F1, and the part number in G1)

    =SUMPRODUCT(($A$1:$A$15>=E1)*($A$1:$A$15<=F1),--($B$1:$B$15=G1),$C$1:$C$15)

    Hopefully this makes sense. If you don't want a date range, but instead want to only have a total for the part since a particular date, you'd modify this as follows:

    =SUMPRODUCT(--($A$1:$A$15>=E1),--($B$1:$B$15=G1),$C$1:$C$15)

    Note that the --(...) is a convention to make the sumproduct formula treat the results of these expressions as numbers instead of True/False values. You don't really need to worry about that part too much unless you're curious.

    Hope that helps,
    Scott

  4. #4
    Registered User
    Join Date
    11-09-2006
    Posts
    65
    Thanks to the great help from both of you.
    After a little messing around I got it to work.
    The problem I have now, is the part number is located in more than 1 column.
    Using your reference formula below seems to only allow 1 column of data for array 2.

    Quote Originally Posted by Maistrye
    =SUMPRODUCT(($A$1:$A$15>=E1)*($A$1:$A$15<=F1),--($B$1:$B$15=G1),$C$1:$C$15)
    Instead of using (B1:B15), I would want to use (B1:F15)

    I am thinking I can just repeat this formula 1 time for each then add the totals, but I am sure there is another better way to achieve this.

    Thanks.

  5. #5
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by surfengine
    Thanks to the great help from both of you.
    After a little messing around I got it to work.
    The problem I have now, is the part number is located in more than 1 column.
    Using your reference formula below seems to only allow 1 column of data for array 2.



    Instead of using (B1:B15), I would want to use (B1:F15)

    I am thinking I can just repeat this formula 1 time for each then add the totals, but I am sure there is another better way to achieve this.

    Thanks.
    It depends on what you mean by multiple columns.

    Do you mean in B1 you might have "AF", in C1 "12", in D1 "00", in E1 "ST", in F1 "RX", with the actual part number being AF1200STRX? This might be quite difficult to do, depending on the data you use. It may be necessary to create a helper column.

    Or do you mean that you would have 5 parts in that row, AF, 12, 00, ST, RX? This situation is easier, but it depends on how you want the cost treated (ie. is the cost the total cost for all 5 parts, or is it the cost for each individual part?).

    Or I might be putting in more thought than is necessary. :-P

    Scott

  6. #6
    Registered User
    Join Date
    11-09-2006
    Posts
    65
    Quote Originally Posted by Maistrye
    Or do you mean that you would have 5 parts in that row, AF, 12, 00, ST, RX? This situation is easier, but it depends on how you want the cost treated (ie. is the cost the total cost for all 5 parts, or is it the cost for each individual part?).

    Or I might be putting in more thought than is necessary. :-P

    Scott
    This is getting complicated I think
    Each row contains up to 5 parts numbers. Each part number is 10 digits long.
    Your above comment made me realize that I have only the total part cost for each row and not individual part cost.

    I think this is way to complex for anything I could hope to recieve an answer for in a forum...but I will post it anyways:

    I need to determine the cost and usage for a list of parts by month.
    The format the parts are in is up to 5 in a row.
    I would need to create a parts table and a cost table.
    Then sort by month and seperate by part type.

    BTW - I did use the SUMPRODUCT for calc the cost by month and product type. thx

  7. #7
    Registered User
    Join Date
    03-17-2006
    MS-Off Ver
    2007
    Posts
    93
    I needed help on the same type formula, only my "date range" was a static number (cell B2)

    First time I've ever been able to get specific help without posting. Always learn from reading, but this time the answer was in the top post!


    My formula:

    =SUMPRODUCT(--($C$17:$C$31=B2),--($F$17:$F$31="complete"),$G$17:$G$31)

    column C being employee number assigned to that job
    column F being (obviously) if the job was complete
    column G being the pay per that job



    thanks for the help!
    Better to be roughly right than exactly wrong, unless you are using Excel.

  8. #8
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by surfengine
    This is getting complicated I think
    Each row contains up to 5 parts numbers. Each part number is 10 digits long.
    Your above comment made me realize that I have only the total part cost for each row and not individual part cost.

    I think this is way to complex for anything I could hope to recieve an answer for in a forum...but I will post it anyways:

    I need to determine the cost and usage for a list of parts by month.
    The format the parts are in is up to 5 in a row.
    I would need to create a parts table and a cost table.
    Then sort by month and seperate by part type.

    BTW - I did use the SUMPRODUCT for calc the cost by month and product type. thx
    Is the price for each part the same for the whole month?
    If the price changes, you'll not get an exact answer.

    How's your linear algebra?

    If it's good, you can determine the cost for all the parts for the whole month. And you can determine the count of each part for that month.

    Then, you just have to set up the system of equations to solve for price of each part. For some, it will be as simple as putting a price in because you have only one item on a given line. You might even be able to do it with Excel. :-P I'm not sure, I'll have to look.

    I can't guarantee I'll be able to give you a response before Tuesday, since I'm off Monday. We'll see, I sometimes don't bother turning on my comp at home.

    Scott

+ 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