+ Reply to Thread
Results 1 to 15 of 15

Nesting SUMPRODUCT in SUMIF

  1. #1
    Registered User
    Join Date
    07-06-2018
    Location
    Seattle, Washington
    MS-Off Ver
    2016
    Posts
    6

    Post Nesting SUMPRODUCT in SUMIF

    I need help writing a SUMIF function with SUMPRODUCT nested inside.
    Here is my example scenario:

    I have a list of managers supporting various territories. Each manager has various numbers of Full-time and Part-time employees with various titles.
    table.JPG

    I want to build a table that was calculate each type of employee for each manager.
    Example for Joe Small's Full-time Employees:
    - If column B = "Joe Small", then sum G2, G5, G8, G11.
    Sum.JPG
    Attached Files Attached Files
    Last edited by ngocdinh; 07-06-2018 at 04:16 PM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Nesting SUMPRODUCT in SUMIF

    Attach example EXCEL file (not a picture, pasted text or any other than Excel format!). This file should be attached to a new post. Never change your original post (except admin's request).

    To attach an Excel file to your post,
    • desensitize data
    • remeber that your example should reflect structure and type of data and contain the result what you want to achieve (manually created if necessary)
    • click Go Advanced,
    • scroll down until you see Manage Attachments,
    • click that and select Browse,
    • select your file and click Open,
    • click Upload and you will see your attachment below Upload Files from a website
    • click Close this window,
    • click Submit reply
    After that you should see attachment in your post

  3. #3
    Registered User
    Join Date
    07-06-2018
    Location
    Seattle, Washington
    MS-Off Ver
    2016
    Posts
    6

    Re: Nesting SUMPRODUCT in SUMIF

    Thanks, Sandy!
    Example excel file has been attached.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Nesting SUMPRODUCT in SUMIF

    Instead of formula you can try PowerQuery aka Get&Transform. THis feature is built-in to Excel 2016 Pro.

    PowerQuery does not contain any worksheet function or VBA code.
    Attached Files Attached Files

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Nesting SUMPRODUCT in SUMIF

    I use 1 helper column (H) to get the Manager then sumifs:
    H2:
    =LOOKUP("ZZZ",$B$2:B2)
    Drag down
    In J3 then drag down:
    =SUMIFS($G$2:$G$13,$H$2:$H$13,$I3,$C$2:$C$13,"FTE")
    Change "FTE" to "PTE" for next coumn
    Attached Files Attached Files
    Quang PT

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Nesting SUMPRODUCT in SUMIF

    In J3 then dragged across.
    Note the changes in J2 and K2

    =SUMPRODUCT(($B$2:$B$11=$I3)*(OFFSET($G$2:$G$11,MATCH(J$2,$C$2:$C$4,0)-1,0)))
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Registered User
    Join Date
    07-06-2018
    Location
    Seattle, Washington
    MS-Off Ver
    2016
    Posts
    6

    Re: Nesting SUMPRODUCT in SUMIF

    Sanday666, thank you for your help! I unfortunately don't have Excel 2016 Pro, so PowerQuery is not activated.

  8. #8
    Registered User
    Join Date
    07-06-2018
    Location
    Seattle, Washington
    MS-Off Ver
    2016
    Posts
    6

    Re: Nesting SUMPRODUCT in SUMIF

    bebe021999 & kvsrinivasamurthy: Both of these solutions worked great! Thank you both so much for your expertise!!!
    Last edited by AliGW; 07-09-2018 at 11:55 AM. Reason: Unnecessary quotation removed.

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Nesting SUMPRODUCT in SUMIF

    Thanks for feed back.

  10. #10
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Nesting SUMPRODUCT in SUMIF

    Thinking out of the box

    =SUM(SUMIFS($G$2:$G$12,$B$2:$B$12,$I3,$C$2:$C$12,"FTE"))

    =SUM(SUMIFS($G$3:$G$13,$B$2:$B$12,$I3,$C$3:$C$13,"PTE"))

    Note that the ranges in columns G and C are moved down by 1 row in the second formula. This is to allow for the merged cells in column B.

  11. #11
    Registered User
    Join Date
    07-06-2018
    Location
    Seattle, Washington
    MS-Off Ver
    2016
    Posts
    6

    Re: Nesting SUMPRODUCT in SUMIF

    Thanks all for your help.
    I ended up using the formula posted by kvsrinivasamurthy.

    I have another lay of this problem and have attached an updated spreadsheet.
    If the territory has an assistant manager, I don't want those quarter's employees to be counted in the total.
    For example: row 3 is Joe Small's Northbay employees.
    In Q1, he did not have an assistant manager, but did in Q2.
    The totals in cell J4 should total 3 but the totals in cell K3 should total 0.

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Nesting SUMPRODUCT in SUMIF

    Quote Originally Posted by ngocdinh View Post
    I ended up using the formula posted by kvsrinivasamurthy.
    Have a read of this https://chandoo.org/wp/handle-volati...-are-dynamite/

    To answer your latest question.

    In J4

    =SUM(SUMIFS($G$2:$G$12,$B$2:$B$12,$I3,$C$2:$C$12,J$2,$F$2:$F$12,"="))

    In K4

    =SUM(SUMIFS($G$3:$G$13,$B$2:$B$12,$I3,$C$3:$C$13,K$2,$F$3:$F$13,"="))

  13. #13
    Registered User
    Join Date
    07-06-2018
    Location
    Seattle, Washington
    MS-Off Ver
    2016
    Posts
    6

    Re: Nesting SUMPRODUCT in SUMIF

    Jason.b75, Thank you very much for your reply.
    I didn't not explain myself properly.

    If in a quarter, the manager has an assistant manager, but total employee count for that quarter should include the assistant manager, but not no employee reporting underneath that manager.

    In the example file I attached:
    Billy Jones' employee count for Q1 should equal 4, and Q2 should equal 1.

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Nesting SUMPRODUCT in SUMIF

    To be sure I'm following the logic correctly now, Joe Small Q2 = 4 (Northbay assistant manager x 1, Eastbay sales associate x 2, Eastbay supervisor x 1) is that correct?

    See if this gives the correct results.

    In H2, enter this formula, then fill down to H12

    =IF(F2>0,F2,G2)

    In J3, and fill down

    =SUMIFS($H$2:$H$12,$B$2:$B$12,$I3,$C$2:$C$12,J$2)

    In K3 and fill down

    =SUMIFS($H$3:$H$13,$B$2:$B$12,$I3,$C$3:$C$13,K$2)

  15. #15
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Nesting SUMPRODUCT in SUMIF

    Billy Jones' employee count for Q1 should equal 4, and Q2 should equal 1.
    How it is. Pl explain with reference to column F and G.

+ 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] nesting COUNTIFS and SUMPRODUCT
    By sick stigma in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-15-2016, 10:14 AM
  2. Nesting SUMIF
    By ForMe2Know in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-29-2013, 12:38 PM
  3. nesting SUMPRODUCT
    By sick stigma in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2013, 12:52 PM
  4. nesting SUMPRODUCT
    By sick stigma in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-07-2013, 12:17 PM
  5. Nesting Index with SumProduct
    By GeneralDisarray in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-18-2011, 12:45 PM
  6. Using SUMPRODUCT when nesting
    By lou031205 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-03-2007, 07:49 AM
  7. [SOLVED] Nesting SUMIF
    By 360Kid in forum Excel General
    Replies: 3
    Last Post: 06-01-2006, 01:10 PM

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