+ Reply to Thread
Results 1 to 14 of 14

How to insert a cell reference into a sumproduct expression?

  1. #1
    Registered User
    Join Date
    05-23-2011
    Location
    Ballston Spa, NY
    MS-Off Ver
    Excel for Office 365
    Posts
    18

    How to insert a cell reference into a sumproduct expression?

    Hello all,

    My very first post so I'll try to do a good job of it. I've created a cost estimating spreadsheet that has come out pretty well, except for one deficiency I can't figure out:

    In general terms, I have a cell (E9) that searches for a task (such as "01.01") and retrieves the row location of that task (for example, row 18). I then have a sumproduct expression that - as now written - relies on user editing the formula with the row # inserted. For example:

    =SUMPRODUCT(--('Detailed Estimate'!$F$3:$J$3='REF Titles and Rates'!$B9),'Detailed Estimate'!$F$18:$J$18)

    I would like to be able to paste this formula across numerous columns and have the formula self-update by inserting the correct row reference. For example, if next task is found in row 32, the formula would be the same except $F$18:$J$18 would change to $F$32:$J$32. I anticipate there's some way to use "indirect" expression but I'm at a loss.

    Please see abbreviated version of my spreadsheet attached. Turning specifically to the attachment:

    On the Detaile Estimate tab, the user selects tasks in the format xx.yy (such as 01.01, 02.03, etc.) that correspond to work assignments. The work is done by people w/ varying job titles (rates of pay); the user selects their titles from the pull-downs (green highlights).

    The manager's estimating is done on the Detailed Estimate tab by entering hours for specific staff people (in the yellow highlighted areas). By copying and pasting the series of rows, additional tasks can be added. In reality, some projects might use very few tasks and some very many (up to about 60). {I gave up on trying to automate the addition or subtraction of tasks...but that's a separate matter }

    Once the estimating is done on the Detailed Estimate tab, I need to be able to total hours in a different fashion: by job title. This is done on the REF Titles and Rates tab, in the blue highlighted areas. In Row 3, I have the spreadsheet retrieving a row identifier, and in columns E & F, I have manually entered the sumproduct formula to total hours by title, so as to illustrate where I'm trying to go. But how can I alter the column E/F formula such that it actively references the Row 3 data above...so I can then paste it across the remaining columns???

    I look forward to your help. Thank you very much for any feedback.

    -Steve
    Attached Files Attached Files
    Last edited by Steve Rutkey; 05-28-2011 at 08:58 PM.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to insert a cell reference into a sumproduct expression?

    Welcome to the forum.

    If you really want SUMPRODUCT() then place this formula in E9 and copy down to E14 then drag that selected range to the right

    =SUMPRODUCT(--('Detailed Estimate'!$F$3:$J$3='REF Titles and Rates'!$B9),INDEX('Detailed Estimate'!$F:$J,E$3,0))

    However, SUMIF() is MUCH better option:

    =SUMIF('Detailed Estimate'!$F$3:$J$3,'REF Titles and Rates'!$B9,INDEX('Detailed Estimate'!$F:$J,E$3,0))
    Last edited by Cutter; 05-26-2011 at 08:07 PM. Reason: Alternative formula

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,420

    Re: How to insert a cell reference into a sumproduct expression?

    Sorry, didn't look at the example properly ... I'll go away and, well, I'll just go away ;-(
    Last edited by TMS; 05-26-2011 at 07:06 PM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to insert a cell reference into a sumproduct expression?

    @TMShucks
    Drinking again?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,420

    Re: How to insert a cell reference into a sumproduct expression?

    @Cutter: just a 1664 earlier on but it's late here and I think I should be in bed. My wife already thinks I'm very sad spending so much time "playing with Excel" as she describes it ;-)

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to insert a cell reference into a sumproduct expression?

    We may be married to the same woman!!!!

  7. #7
    Registered User
    Join Date
    03-22-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to insert a cell reference into a sumproduct expression?

    I'm not sure if you are absolutely committed to using sumproduct. I think I have achieved what you need using SUMIF and INDIRECT. You can probably apply the INDIRECT to your SUMPRODUCT but it would be that much more complicated.

    The one proviso is that you have the Worksheet set to Lotus Compatibility in the advanced settings. This needs to be un-ticked. If this is a deal breaker then some other solution besides INDIRECT will need to be used.

    Let me know if this is close.
    Attached Files Attached Files

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to insert a cell reference into a sumproduct expression?

    @moreeg

    I offered a SUMIF() and INDEX() solution in post #2. That would be preferable to the volatile INDIRECT() option.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,420

    Re: How to insert a cell reference into a sumproduct expression?

    @Cutter: so we may be related by marriage!? I'll call by when we visit Canada next year, all being well ... all being well that we visit Canada, that is.

    Regards

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to insert a cell reference into a sumproduct expression?

    I look forward to it!
    But, isn't the world supposed to end in October? Now that it didn't end last week!

  11. #11
    Registered User
    Join Date
    03-22-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: How to insert a cell reference into a sumproduct expression?

    @Cutter - Apologies. I didn't read post #3 carefully enough - I thought that was you disavowing the post #2 solution. I wouldn't, as a strict rule, offer a solution when one has already been supplied - especially a better solution. I accept that INDEX is more efficient than INDIRECT. My solution is a reflection of my Excel expertise and, as indicated was not intended to one-up you. Again, my sincerest apologies.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,420

    Re: How to insert a cell reference into a sumproduct expression?

    @Cutter: If it happens, it happens ... we won't be coming ;-(

  13. #13
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to insert a cell reference into a sumproduct expression?

    @ moreeg
    No apologies needed my friend. If you've got a better solution than what has been suggested you should certainly post it. I'm still learning and I'm always eager to see alternatives. I just wanted to point out to you my alternative to the SUMPRODUCT() because it appeared you may have missed it.

  14. #14
    Registered User
    Join Date
    05-23-2011
    Location
    Ballston Spa, NY
    MS-Off Ver
    Excel for Office 365
    Posts
    18

    Re: How to insert a cell reference into a sumproduct expression?

    Cutter and moreeg,

    Sorry for my slow response - was away from the computer for a couple of days. But thank you very much. Cutter did in fact have two solutions right off the bat...and I agree that the SUMIF method works better. Moreeg's method works as well. I'll go with the SUMIF as it is concise and effective. I greatly appreciate your help!

+ 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