+ Reply to Thread
Results 1 to 4 of 4

Help with IF and SUMPRODUCT to calculate weighted average??

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    38

    Help with IF and SUMPRODUCT to calculate weighted average??

    Hoping for some help yet again! I have a detailed list of balances and am I trying to summarize the information to calculate the weighted average based on country. I'm using SUMPRODUCT to calculate the weighted average but I do not know how to incorporate an IF statement to only pick up certain balances. Attached is my example and formula attempt.

    Thank you in advance!
    Book6.xlsx

  2. #2
    Registered User
    Join Date
    10-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2007, 2010, 2011
    Posts
    4

    Re: Help with IF and SUMPRODUCT to calculate weighted average??

    Consulttk,

    Your formula should be like this:

    =SUMPRODUCT(($A$4:$A$7=$A12)*($C$4:$C$7)*($D$4:$D$7))/SUMIF($A$4:$A$7,$A12,$C$4:$C$7)

    Note: The ranges above directly relate to the ranges in your example workbook.
    $A$4:$A$7 = range containing Region names
    $A12 = range containing "USA"
    $C$4:$C$7 = range containing Interest Inc values
    $D$4:$D$7 = range containing 30-day Yield values

    I tested against both examples (USA & Europe) and got the correct results as you manually calculated.

    Enjoy.

  3. #3
    Registered User
    Join Date
    10-04-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Help with IF and SUMPRODUCT to calculate weighted average??

    This is awesome, I never would have figured that out! Thank you so much!

  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,933

    Re: Help with IF and SUMPRODUCT to calculate weighted average??

    try this...
    =SUMPRODUCT((A4:A7=A12)*(C4:C7)*(D4:D7))/SUMIF(A4:A7,A12,C4:C7)
    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

+ 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