+ Reply to Thread
Results 1 to 12 of 12

Using SUMPRODUCT for multiplying cells based on multiple criteria

  1. #1
    Registered User
    Join Date
    12-07-2010
    Location
    Alameda, CA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Using SUMPRODUCT for multiplying cells based on multiple criteria

    I am having difficulty creating a formula and I'm unsure of what function I need to use. I have a spreadsheet with a list of items, i.e. Item 1, Item 2, Item 3, etc. I want to calculate the Unit Hours*Qty by a specific Unit Hour associated with each Item, depending on which Item is listed in that row.

    The formula below is the best way I can describe what I'm trying to do, I think.

    I know I'm missing something yet I can't figure out what it is.

    =SUMPRODUCT(a9:a13=e3,b9*d3 OR a9:a13=e4,b10*d4 OR a9:a13=e5,b11*d5 OR a9:a13=e6,b12*d6)

    Both columns D & E relate to each other; their range is D3:E6, which is static. I want excel to check Column A for a matching value in the specified range in Column E, then return the value of the corresponding specified Column D value multiplied by the value in Column B.

    I hope this makes sense. I have attached a screenshot of what I'm working with.
    Thanks in advance for your help!!!
    Attached Images Attached Images
    Last edited by anon1219; 12-07-2010 at 04:23 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    It seems as if a normal SUMIF() should suffice for you.

    In F3, try this, then copy down:

    =SUMIF(A:A, E3, B:B)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-07-2010
    Location
    Alameda, CA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Thank you, but that didn't work. Any other ideas?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Yes, that does work. Your values in column A need to exactly match the value in E3. No hidden spaces (check for that).

    If you can't find the problem, post a workbook so we can spot the problem for you. Click GO ADVANCED and use the paperclip icon to post up your workbook.

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

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Reverse the values you have in Col D and Col E so that you have "Description" in Col D and "Unit Hr" in Col E.

    Then use:

    =VLOOKUP(A9,$D$3:$E$6,2,0)*B9

    and drag down

    We are providing answers for 2 different things here.

    Mine is for Cell C9 and copied down.

    JB's is for Cell F3 copied down
    Last edited by Cutter; 12-07-2010 at 04:07 PM.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    The other formula you need in C9 would be:

    =INDEX($D$3:$D$6, MATCH($A9, $E$3:$E$6, 0)) * $B9

    ...copy that down.

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

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    JB

    You don't agree that switching Col D and Col E is simplest?

  8. #8
    Registered User
    Join Date
    12-07-2010
    Location
    Alameda, CA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Thanks, Cutter!!! This worked! I had a feeling I should use vlookup and that I might need to rearrange the columns...

    Thank you for your help, JBeaucaire.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Quote Originally Posted by Cutter View Post
    You don't agree that switching Col D and Col E is simplest?
    No. It's a great solution for fans of VLOOKUP, which I'm not. VLOOKUP requires the data to be "searched" always be on the left, an inherently inconvenient requirement depending on what piece of info you're searching for. INDEX/MATCH does not suffer that requirement, so I pretty much use it for everything.

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Can you clarify please, anon, I assumed you were looking for a formula for F3:F6 is that correct?

    If so are those values that you have in F3:F6 the expected results for your example?

    If not can you indicate for which cells you require a formula and what the results should be in your example
    Audere est facere

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Anon, note my original solution was for getting the SUMS in cells F3 downward. Sorry if I misunderstood your primary need.

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  12. #12
    Registered User
    Join Date
    12-07-2010
    Location
    Alameda, CA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using SUMPRODUCT for multiplying cells based on multiple criteria

    Thank you all for your help!! I apologize if I wasn't very clear. This was my first time asking for help.

    JB, your advice for using the INDEX/MATCH functions is very good to know for future reference in the case of a more complex spreadsheet where it would become "messy" when rearranging columns.

+ 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