+ Reply to Thread
Results 1 to 14 of 14

Formula to sum multiple values from table if values in other set of cells matches criteria

  1. #1
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Formula to sum multiple values from table if values in other set of cells matches criteria

    Hello gurus,

    I've attached the file I'm attempting to work with for reference.

    I'm trying to create a formula in cell C14 that looks at the values in cells A8:A13, matches those values against corresponding data in the HC and CS per HR table, to sum the values from column D of those matching data points, kind of like a multiple vlookup/sum of lookup results, does that make sense?

    Suggestions would be greatly appreciated!

    Thanks in advance you beautiful minded geniuses :-)

    George
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    What would an expected answer look like, in this case?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    Hi Ford, thanks for looking at this so quickly.

    The expected answer for cell C14 would be 80, which is the sum of headcount values from column D in the HC and CS per HR sheet, for the corresponding SKUs listed in column A of the Scheduling template sheet, cells A8:A13

    SKU Headcount Processing (column D)
    11111 34.0
    11112 8
    11113 9
    11114 9
    11115 10
    11116 10

    George

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    Try this ARRAY formula in C214...
    =SUM(SUMIF('HC and Cases Per Hour'!$A$5:$A$132,A8:A13,'HC and Cases Per Hour'!$D$5:$D$132))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  5. #5
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    BOOM! that did the trick, thank you good sir, your solution did the trick beautifully!

    I appreciate you taking the time to help me, thank you, Ford!

    Sincerely,

    George

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    Happy to help and thanks for the feedback

  7. #7
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    Hi Ford,

    Sorry about this, turns out it's a little more complicated than I initially thought - there needs to be an additional layer of criteria in the formula that directs existing formula to only return headcount if there is case quantity data across from the material data being looked up.

    for example, current formula is {=SUM(SUMIF('HC and Cases Per Hour'!$A$5:$A$132,A8:A13,'HC and Cases Per Hour'!$F$5:$F$132))} - it needs to also consider only returning a value for a match when cases are scheduled to be produced against it, and only return the headcount required for that material being produced.

    So in the attached workbook, for the 6 examples listed, the expected result for the formula would be as follows - only returning headcount for matched mateirals that have corresponding production planned against them on the given day - does this make sense?

    C14 = 34
    D14 = 34
    F14 = 10
    G14 = 10
    I14 = 11
    J14 = 11
    L14 = 13
    M14 = 13
    O14 = 14
    P14 = 14
    R14 = 14
    S14 = 14

    Sorry again Ford, I though we had it the first time around.

    George
    Attached Files Attached Files

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    No problem, try this...
    =SUM(SUMIFS('HC and Cases Per Hour'!$D$5:$D$132,'HC and Cases Per Hour'!$A$5:$A$132,($A$8:$A$13)*(C8:C13>0)))
    still ARRAY entered.

    I MAY be using the wrong column to sum though, I am using column D, and for F/G14, I get 8, not 10. BUT if I was using column F, I would get 10??

  9. #9
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    Hi Ford,

    I'm feeling guilty here because I've been short sighted in my planning efforts and have failed to recognize scenarios that are appearing now as I work more with the new automation you've provided. In this case, the new scenario relates to one shift that has more than one material scheduled to run. The 2nd formula provided does exactly what I asked for it to do, except I'm realizing now that when multiple materials run back to back on the same shift, the formula returns an inflated headcount. So what I'm hoping can be done is that one final layer of criteria be added into the formula to only return the highest value of the two (or more) summed values when multiple materials are being run on the same shift.

    For example, if material 11111, Example 1 is being run, and needs 5 headcount to make it, and it's followed by material 11112, Example 2, and it needs 10 headcount to make it, the formula currently returns 15, the sum of the two. Can an extra layer of criteria be added to the formula to tell it to only return the 10?

    I've attached an updated example file, and have modified cells B8:B16 to show what the headcount is for each particular example, and have modified row 18 to show the expected value of the new formula in row 17.

    I hope this makes sense. Thank you for the help Ford, this ought to be last time we revisit this, I appreciate your time!!

    George
    Attached Files Attached Files

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    No problem with the extra requirements, that often happens once you start getting the analysis done correctly.

    However, Im beginning to wonder is adding is the right thing to do here? Could you have more than 1 "11111 example 1" run on 1 day? and if so, would you need to ADD the ee's together, or just use the 1 value?

    By reason for asking is that if you are not really adding head-counts, then there is no real point in using SUM

  11. #11
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    That's a very good point, and you're right. The bigger picture, we have three separate lines that are staffed by three different teams, so the formula for each line does not need to sum the headcount, only return the actual headcount required for the material being run if only one material is being run on the shift; or, if more than one material is being run on the same shift, the formula only needs to return the highest headcount of the materials being run on that shift. Does that make things easier?

    As to the question whether more than 1 "11111 Example 1" will run on one shift, no, it might run on next shift or the day after, but not be documented as two separate line items on the schedule.

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    OK, I tried to get fancy with INDEX/MATCH/MAX/IF, but then saw that what I had was pretty much working, I just needed to MAX the answer, not SUM it. Try this instead,...
    =MAX(SUMIFS('HC and Cases Per Hour'!$F$5:$F$132,'HC and Cases Per Hour'!$A$5:$A$132,($A$8:$A$16)*(D8:D16>0)))

    still ARRAY entered

  13. #13
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    Ford, you are my hero, brother, thank you sir! This did the trick, for real this time - these array formulas are something else!

    I really appreciate the time you took to resolve this, this solution is a huge help for our scheduling team!

    George

  14. #14
    Registered User
    Join Date
    11-25-2012
    Location
    Brantford, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Formula to sum multiple values from table if values in other set of cells matches crit

    LOL, just tried giving you rep again, but the site wants me to spread some reputation around before giving you more for your efforts.

    Thanks Ford!

    George

+ 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. [SOLVED] Multiple lookup criteria and sum values based on matches.
    By skonduru in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-31-2016, 11:53 PM
  2. [SOLVED] Lookup Values which meet two or more criteria and return multiple matches horizontally
    By josetmg in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-03-2015, 01:16 AM
  3. Replies: 5
    Last Post: 09-01-2014, 08:05 AM
  4. Replies: 2
    Last Post: 03-03-2014, 10:03 PM
  5. If values in 2 cells matches criteria, add text to a third cell
    By Zarkov in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2011, 03:14 PM
  6. Replies: 6
    Last Post: 04-21-2009, 07:00 PM
  7. summing table values with multiple criteria from a dynamic table
    By griffith in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-06-2005, 05:51 PM

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