+ Reply to Thread
Results 1 to 8 of 8

Need a formula for a weighted average that ignores blanks.

  1. #1
    Forum Contributor
    Join Date
    01-07-2012
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    157

    Need a formula for a weighted average that ignores blanks.

    Hi All,

    Please see attached. Column R is what I want to be returned in Column P. I am just struggling with how to make the formula.

    Note Column M will never be blank but N and/or O could be.

    Thanks
    Attached Files Attached Files
    Last edited by PaddyP; 03-24-2023 at 12:43 AM.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Need a formula for a weighted average that ignores blanks.

    try this...
    =IF(AND(M8<>"",N8<>"",O8<>""),(M8*$M$6)+(N8*$N$6)+(O8*$O$6),IF(AND(N8="",O8<>""),(M8*$M$6)+(O8*$O$6),IF(AND(N8<>"",O8=""),(M8*$M$6)+(N8*$N$6),M8)))

    this is on the assumptions that, a) M will never be blank and b) if only M is populated you don't need that multiplied by the weight in M6.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Need a formula for a weighted average that ignores blanks.

    Out of curiosity, why are you multiplying the numbers in each row by their weights THEN dividing them by the addition of the weights in their respective columns?
    and BTW, this is a shorter version of what I gave you earlier that will return the same values but those values simply match what is in col P, not R...
    =M8*$M$6+N8*$N$6+O8*$O$6

  4. #4
    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
    44,425

    Re: Need a formula for a weighted average that ignores blanks.

    I can give you several formulae that return the values you have, but say you don't want.

    TMS 1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    TMS 2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    TMS 3
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I can also give you more consistent versions of the formulae that you say gives the results you want:

    TMS 1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    TMS 2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    TMS 3
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    TMS 4
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    TMS 5
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    That said, I do not understand the logic that gives you the answers that you do want
    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


  5. #5
    Forum Contributor
    Join Date
    01-07-2012
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    157

    Re: Need a formula for a weighted average that ignores blanks.

    Thanks for the responses but these formulas wont work.

    The logic is I want to take a weighted average using A, B & C but there will be instances where B or C may not have a result. In those instances I want to take a new weighted average.

    Looking at Option # 2 for example. Model A predicts 67 and Model C predicts 75. Since Model B did not make a prediction the new weight for A would be 60/75 and C becomes 15/75. Which is 80% and 20% (The same ratio of A to C we wanted in the first place)

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Need a formula for a weighted average that ignores blanks.

    If I am understanding correctly, you are wanting to use a sum(xi*wi)/sum(wi) [where xi are the values and wi are the weights] to calculate your weighted averages, is that correct?

    My implementation of this kind of weigted average would be:

    1) sum(xi*wi) is a simple SUMPRODUCT() -- SUMPRODUCT(M8:O8,$M$6:$O$6). Note the mix of relative and absolute references.
    2) sum(wi) would be a simple SUM($M$6:$O$6) if there were no conditions, but you have indicated you only want to sum the weights where there is a value present in row 8. I use a SUMIFS() to perform the conditional sum SUMIFS($M$6:$O$6,M8:O8,">0") where I am assuming that the cells in M8:O8 can never be a value <=0. If my assumption is incorrect, then we'll need to come up with a different criteria.

    Is that what you are trying to do?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Contributor
    Join Date
    01-07-2012
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    157

    Re: Need a formula for a weighted average that ignores blanks.

    Winner winner!

    Fantastic formula this is exactly what I was looking for!

    You are correct to assume that there will not be values <0

    Thank you very much!

  8. #8
    Registered User
    Join Date
    03-16-2023
    Location
    Toronto, Canada
    MS-Off Ver
    2019
    Posts
    2

    Re: Need a formula for a weighted average that ignores blanks.

    Yes.
    That's a good solution. I try and success.
    Last edited by dhaka007; 03-24-2023 at 01:50 AM. Reason: already solve.

+ 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. weighted average depending on category, ignoring blanks
    By Khaldun106 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-15-2021, 10:37 PM
  2. Replies: 1
    Last Post: 08-06-2019, 10:43 PM
  3. Rolling average using offset that ignores blanks
    By jd33a in forum Excel General
    Replies: 1
    Last Post: 09-07-2017, 05:14 PM
  4. Weighted average that conditionally sums based on name and ignores #N/A
    By cmshawks2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-15-2015, 04:28 AM
  5. Weighted multiplication formula that ignores zeroes
    By anansi00 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-20-2014, 05:01 AM
  6. Weighted Average without blanks
    By zvot in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-06-2014, 12:28 PM
  7. [SOLVED] Due dates formula in conditional formatting that ignores blanks
    By ciapul12 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-31-2013, 08:48 AM

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