+ Reply to Thread
Results 1 to 6 of 6

sumproduct and sumif to get weighted average

Hybrid View

milo1984 sumproduct and sumif to get... 05-15-2018, 10:38 AM
TMS Re: sumproduct and sumif to... 05-15-2018, 10:47 AM
milo1984 Re: sumproduct and sumif to... 05-15-2018, 11:43 AM
dflak Re: sumproduct and sumif to... 05-15-2018, 11:55 AM
FDibbins Re: sumproduct and sumif to... 05-15-2018, 11:56 AM
milo1984 Re: sumproduct and sumif to... 05-15-2018, 12:07 PM
  1. #1
    Forum Contributor
    Join Date
    08-20-2012
    Location
    London,England
    MS-Off Ver
    Excel 2010
    Posts
    184

    sumproduct and sumif to get weighted average

    Hi,

    we use a formula to get a weighted average
    =SUMPRODUCT(D2:D14,C2:C14)/SUM(D2:D14)
    .

    I would like to incorporate some SUMIFs based on some criteria. average by Country as an example.

    what formula would I need to enter in cell J2 of the attached example data?

    Many thanks in advance
    Attached Files Attached Files

  2. #2
    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,208

    Re: sumproduct and sumif to get weighted average

    Try:
    Formula: copy to clipboard
    =SUMPRODUCT((A$2:A$14=I2),(D$2:D$14),(C$2:C$14))/SUM(D$2:D$14)
    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


  3. #3
    Forum Contributor
    Join Date
    08-20-2012
    Location
    London,England
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: sumproduct and sumif to get weighted average

    Hi Trevor,

    unfortunately, I just get 0 as a result. any other suggestions?

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: sumproduct and sumif to get weighted average

    I think this needs to be either
    =SUMPRODUCT((A$2:A$14=I2) * (D$2:D$14) * (C$2:C$14))/SUM(D$2:D$14)
    or
    =SUMPRODUCT(--(A$2:A$14=I2),--(D$2:D$14),--(C$2:C$14))/SUM(D$2:D$14)
    My preference is for the first incantation where * is analogous to AND and + is analogous to OR.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  5. #5
    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
    53,048

    Re: sumproduct and sumif to get weighted average

    Im confused....
    I would like to incorporate some SUMIFs based on some criteria. average by Country as an example.
    do you want SUM or average?
    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

  6. #6
    Forum Contributor
    Join Date
    08-20-2012
    Location
    London,England
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: sumproduct and sumif to get weighted average

    great, thanks Trevor. they both worked.

+ 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. Replies: 0
    Last Post: 02-15-2018, 03:04 AM
  2. [SOLVED] Using Sumproduct to calculate weighted average
    By Excel15 in forum Excel General
    Replies: 3
    Last Post: 03-11-2015, 10:33 AM
  3. sumproduct function for weighted average
    By copperdog in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2014, 10:18 PM
  4. [SOLVED] Weighted Average with (=sumproduct and =sumif)
    By wagstaffjh in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-22-2014, 12:30 PM
  5. Weighted Average IF (sumproduct conditional)
    By Leopold2000 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2013, 03:27 PM
  6. [SOLVED] SUMIF with weighted average
    By pansovic in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-03-2012, 06:29 PM
  7. [SOLVED] Help with IF and SUMPRODUCT to calculate weighted average??
    By consulttk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-02-2012, 03:56 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