+ Reply to Thread
Results 1 to 10 of 10

Calculate weighted average with missing values

  1. #1
    Registered User
    Join Date
    10-21-2009
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Calculate weighted average with missing values

    Hi folks, hope somebody can help.

    What I am trying to do is do a weighted calculation based on the results (values entered) for the three most recent months. The formula works on the basis of (Most recent Month *0.6) + (2nd most recent month * 0.2) + (3rd most recent month * 0.2)

    However, each row will not have entries for each of the months. The attached sheet will explain further.

    In Row 3 you will see entries(results) for May, April and March making the calculation straightforward. However, in Row 5 there is no entry (result) thus requiring that the calculation use the value for February.

    How can I get the calculation (in row G) to account for missing values in some of the months.

    Thanks

    Rob
    Attached Files Attached Files
    Last edited by Deiseman; 06-08-2010 at 10:05 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Calculate weighted average with missing values

    Maybe this?

    Edit: NO, sorry, not good.. This take 3 greatest values.. Not 3 last values...
    Attached Files Attached Files
    Last edited by zbor; 06-08-2010 at 07:36 AM. Reason: NO, sorry, not good.. This take 3 greatest values.. Not 3 last values...

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculate weighted average with missing values

    one possibility might be:

    =SUM((MOD(LARGE(IF(ISNUMBER(B3:F3)*(B3:F3<>0),COLUMN(B3:F3)+(B3:F3/100000)),{1,2,3}),1)*100000)*$I$1:$K$1)
    confirmed with CTRL + SHIFT + ENTER

    though it's unclear as to your preference should have fewer than 3 valid data points

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Calculate weighted average with missing values

    Great job DO...

    However, this should be divided with 3 for average, right?

    Or, perhapes, with: =MIN(3,COUNT(B3:F3))

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculate weighted average with missing values

    Quote Originally Posted by zbor
    However, this should be divided with 3 for average, right?
    No I don't believe so - the % are being apportioned.

    ie equiv. to having 60 entries of 50%, 20 entries of 40% and 20 entries of 30% - the Average of those 100 points would be 44% which is equiv. to SUM(0.5*0.6,0.4*0.2,0.3*0.2)

  6. #6
    Registered User
    Join Date
    10-21-2009
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Calculate weighted average with missing values

    Thanks for your efforts so far.

    DonkeyOte, your formula in #3 gives me an answer in G3 of 0.00%, where it should read 44%. Also to clarify, It should only do the calculation where there are at least 3 valid data points. It should give an error message where there are fewer than 3.

    Thanks again.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculate weighted average with missing values

    Quote Originally Posted by Deiseman
    Donkeyote, your formula in #3 gives me an answer in G3 of 0.00%, where it should read 44%
    Note the text in bold red font underneath the suggested formula.

    Based on your sample - the results would be:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-21-2009
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Calculate weighted average with missing values

    Apologies, just spotted that! It works perfectly almost.

    The answer for 'Dublin' shows as 26%, but I need it to calculate using the May, April and March values of 0%, 20% & 30% respectively. I should have been clearer but 0% is a valid data point and should be included in the calculation.

    Thanks again.

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculate weighted average with missing values

    In which case we simply remove the (B3:F3<>0) condition from the pre-emptive test:

    =SUM((MOD(LARGE(IF(ISNUMBER(B3:F3),COLUMN(B3:F3)+(B3:F3/100000)),{1,2,3}),1)*100000)*$I$1:$K$1)
    confirmed with CTRL + SHIFT + ENTER

  10. #10
    Registered User
    Join Date
    10-21-2009
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Calculate weighted average with missing values

    You Sir are a gentleman and a scholar! Thank you so much for your help and perseverence.

+ 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