+ Reply to Thread
Results 1 to 5 of 5

Weighted Average

Hybrid View

  1. #1
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Weighted Average

    Hello,

    Can anybody help me with altering a little the following function:

    I am using sumproduct to find Weighted Average if my data is arragned like this:

    Cost Number of Items
    100 : 5
    200 : 2
    300 : 3

    the formula =SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4) is working great.

    As I have my data arranged differently, I was wondering if I can change the formula.

    My data is like this:
    Cost Item Cost Item Cost Item
    100 5 200 2 300 3

    How should I change the formula in this case?
    Last edited by Bob@Sun; 06-28-2010 at 08:50 AM.

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

    Re: Weighted Average

    You would use something like:

    =SUMPRODUCT(MOD(COLUMN($A2:$E2),2),$A2:$E2,$B2:$F2)/SUMIF($A$1:$F$1,"Item",$A2:$F2)

  3. #3
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Weighted Average

    Hello,

    I have faced a very strange formula behavior.

    In the attached file you can see that I have exactly the same formula but when applied on different place on the sheet I get different result

    Any ideas why is that??????
    Attached Files Attached Files

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,698

    Re: Weighted Average

    By using MOD and COLUMN in conjuction you are getting the result based on whether the columns are "even" or "odd", Because one of your tables starts in an "odd" column and the other in an "even" column that won't work. Perhaps try this version in B4

    =SUMPRODUCT((A1:C1="Cost")+0,A2:C2,B2:D2)/SUMIF(A1:D1,"Item",A2:D2)

    If you copy to G4 it'll still work
    Audere est facere

  5. #5
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Weighted Average

    Thanks a lot!

    This worked.

+ 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