+ Reply to Thread
Results 1 to 8 of 8

Weighted Average Sumproduct Multiple Criteria with Data in One Column

  1. #1
    Registered User
    Join Date
    11-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Weighted Average Sumproduct Multiple Criteria with Data in One Column

    Hi, I'm looking for a formula/approach to perform a weighted average across multiple criteria with the data in the same column.

    This has been bugging me for some time and I know I can count on the EF contributors for direction.

    My data consists of two columns: ColA is the criteria, ColB contains the values.

    ColA ColB
    AG 1
    AG-TERM 2
    AG-VALUE 3
    ZP 11
    ZP-TERM 12
    ZP-VALUE 13
    ZP 21
    ZP-TERM 22
    ZP-VALUE 23

    GOAL: use a dynamic formula that will calc an accurate wght. avg based on the multiple criteria selections from ColA.

    Example 1: Calc the Wght. Avg. of "ZP-TERM" (returning value should = 18.5625). Formula: (11*12+21*22)/SUM(11,21)
    Example 2: Calc the Wght. Avg. of "ZP-VALUE" (returning value should = 19.5625). Formula: (11*13+21*23)/SUM(11,21)

    Please see attached for sample data (there are two different data layouts). Weighted Average Sumproduct Multiple Criteria.xlsb

    My actual data set cannot be consolidated further (in which would eliminate the repeating criteria labels)...I tried that approach first, just not an option given the data source.

    TIA! Very much appreciated!
    Last edited by azaremb; 12-09-2014 at 03:25 PM. Reason: Typo--revised the example formulas

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    Your criteria definition doesn't appear to be consistent in your post.

    The value of 11 is associated with "ZP" and not "ZP-TERM." Is this intentional?
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    Not sure about the first layout, the second one is better

    Use
    =SUMPRODUCT((B18:B20="ZP")*(C18:C20)*(INDEX(D18:E20,,MATCH("Value",D17:E17,0))))/SUMIF(B18:B20,"ZP",C18:C20)

    Change highlighted portions for varying results
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Registered User
    Join Date
    11-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    Yes, the sample data is intentional...just meant to show that within my actual data the same label may appear more than once, and with different values.

    And for each instance of a label (e.g. "ZP"), there will always be a "ZP-TERM" and a "ZP-VALUE".

    TIA!!!

  5. #5
    Registered User
    Join Date
    11-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    Any thoughts, ideas on a formula for the data layout in rows? This is the current data source output format--sample table in first post above.

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    You just need a way to reference ZP. I put it in D10:D11.

    TERM, F10:
    =SUMPRODUCT((($B$3:$B$11=D10)*($C$3:$C$11)),(($B$4:$B$12=D10&"-TERM")*($C$4:$C$12)))/SUMPRODUCT(($B$3:$B$11=D10)*($C$3:$C$11))

    VALUE, F11:
    =SUMPRODUCT((($B$3:$B$11=D11)*($C$3:$C$11)),(($B$5:$B$13=D11&"-VALUE")*($C$5:$C$13)))/SUMPRODUCT(($B$3:$B$11=D11)*($C$3:$C$11))

  7. #7
    Registered User
    Join Date
    11-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    Quote Originally Posted by daffodil11 View Post
    You just need a way to reference ZP. I put it in D10:D11.

    TERM, F10:
    =SUMPRODUCT((($B$3:$B$11=D10)*($C$3:$C$11)),(($B$4:$B$12=D10&"-TERM")*($C$4:$C$12)))/SUMPRODUCT(($B$3:$B$11=D10)*($C$3:$C$11))

    VALUE, F11:
    =SUMPRODUCT((($B$3:$B$11=D11)*($C$3:$C$11)),(($B$5:$B$13=D11&"-VALUE")*($C$5:$C$13)))/SUMPRODUCT(($B$3:$B$11=D11)*($C$3:$C$11))

    Wow, never would've thought to try offsetting the lookup ranges for the "TERM" and "VALUE" vals. This is Excel knowledge at higher level.

    Huge thanks to daffodil11 and Ace_XL. SOLVED--Formula will apply to many contexts.

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Weighted Average Sumproduct Multiple Criteria with Data in One Column

    I remember the exact document I was working with three years ago the first time someone showed me offsetting ranges.

    It was a phoneswitch output, with names on some lines, and stats per person on successive lines, offset 4 rows and 9 columns.

    It's a beautiful thing.

+ 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] Weighted Average with Multiple Qualifying Criteria
    By bpiereder in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2014, 03:31 PM
  2. Replies: 6
    Last Post: 11-25-2013, 08:35 PM
  3. Weighted average w/ multiple text criteria excel 2010
    By mischge in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-31-2013, 11:34 AM
  4. SUMPRODUCT Issue - Need to calculate weighted average of multiple ranges
    By arcobalt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-01-2012, 04:55 PM
  5. Replies: 6
    Last Post: 10-30-2012, 02:35 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