+ Reply to Thread
Results 1 to 8 of 8

Find if a value exists in another list and then calculate weighted average

  1. #1
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    429

    Find if a value exists in another list and then calculate weighted average

    Hello, I'm looking for help for my tricky formula. Thanks in advance.

    There are two groups: Group 1 has two columns of ID and weight, and Group 2 has two columns of ID and score. I want to calculate the weighted average of the scores. So the first step is to check if the IDs in Group 1 exists in Group 2, and then do the weighted average calculation for the score.

    To make it easy to explain, I attached the formula here. Thank you for your help.
    Attached Files Attached Files
    Last edited by billj; 10-30-2013 at 12:07 PM.

  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: Find if a value exists in another list and then calculate weighted average

    Tried from a few different directions but couldn't come up with anything nonVB that didn't include more than one step.

    Here's a two-step solution.

    vlookup product.xlsx

  3. #3
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    429

    Re: Find if a value exists in another list and then calculate weighted average

    Seeming an interesting but tricky one. Still waiting for someone to help

  4. #4
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    429

    Re: Find if a value exists in another list and then calculate weighted average

    Hi, daffodil11, I appreciate your trying to help me out.

    Quote Originally Posted by daffodil11 View Post
    Tried from a few different directions but couldn't come up with anything nonVB that didn't include more than one step.

    Here's a two-step solution.

    Attachment 274544

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

    Re: Find if a value exists in another list and then calculate weighted average

    No problem. I hit a brick wall attempting to multiply the arrays against each other.

    I was able to the denominator with a SUMPRODUCT but then couldn't go any further.

  6. #6
    Forum Guru XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Find if a value exists in another list and then calculate weighted average

    Hi,

    Managed to get it into one array formula (though it's hardly elegant!):

    =SUM((SUBTOTAL(9,OFFSET(E2,SMALL(IF(ISNUMBER(MATCH(D2:D11,A2:A5,0)),ROW(D2:D11)-MIN(ROW(D2:D11)),""),ROW(INDIRECT("1:"&SUMPRODUCT(--(ISNUMBER(MATCH(D2:D11,A2:A5,0))))))),,,))*N(OFFSET(B2,SMALL(IF(ISNUMBER(MATCH(A2:A5,D2:D11,0)),ROW(A2:A5)-MIN(ROW(A2:A5)),""),ROW(INDIRECT("1:"&SUMPRODUCT(--(ISNUMBER(MATCH(A2:A5,D2:D11,0))))))),,,))))/SUM(SUBTOTAL(9,OFFSET(B2,SMALL(IF(ISNUMBER(MATCH(A2:A5,D2:D11,0)),ROW(A2:A5)-MIN(ROW(A2:A5)),""),ROW(INDIRECT("1:"&SUMPRODUCT(--(ISNUMBER(MATCH(A2:A5,D2:D11,0))))))),,,)))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  7. #7
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    429

    Re: Find if a value exists in another list and then calculate weighted average

    Hi XOR LX, my thumb up and hat off for this advanced formula. Not easy to get this solved. I'm convinced that there is not an easy solution for this problem. So I may just take separate steps to do this. THANK YOU!

    Quote Originally Posted by XOR LX View Post
    Hi,

    Managed to get it into one array formula (though it's hardly elegant!):

    =SUM((SUBTOTAL(9,OFFSET(E2,SMALL(IF(ISNUMBER(MATCH(D2:D11,A2:A5,0)),ROW(D2:D11)-MIN(ROW(D2:D11)),""),ROW(INDIRECT("1:"&SUMPRODUCT(--(ISNUMBER(MATCH(D2:D11,A2:A5,0))))))),,,))*N(OFFSET(B2,SMALL(IF(ISNUMBER(MATCH(A2:A5,D2:D11,0)),ROW(A2:A5)-MIN(ROW(A2:A5)),""),ROW(INDIRECT("1:"&SUMPRODUCT(--(ISNUMBER(MATCH(A2:A5,D2:D11,0))))))),,,))))/SUM(SUBTOTAL(9,OFFSET(B2,SMALL(IF(ISNUMBER(MATCH(A2:A5,D2:D11,0)),ROW(A2:A5)-MIN(ROW(A2:A5)),""),ROW(INDIRECT("1:"&SUMPRODUCT(--(ISNUMBER(MATCH(A2:A5,D2:D11,0))))))),,,)))

    Regards

  8. #8
    Forum Guru XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Find if a value exists in another list and then calculate weighted average

    Don't blame you! And you're welcome!

+ 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. Calculate weighted average for values between two date ranges.
    By chan069 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-25-2014, 01:12 AM
  2. [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
  3. How can I calculate a weighted average in a Pivot Table?
    By petevang in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-23-2012, 12:56 PM
  4. Calculate weighted average with missing values
    By Deiseman in forum Excel General
    Replies: 9
    Last Post: 06-08-2010, 10:03 AM
  5. Weighted Average with NA...can't calculate
    By salmanjan in forum Excel General
    Replies: 5
    Last Post: 04-18-2008, 08:24 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