+ Reply to Thread
Results 1 to 7 of 7

sum and weight average variable data

Hybrid View

  1. #1
    Registered User
    Join Date
    12-13-2008
    Location
    Australia
    Posts
    12

    sum and weight average variable data

    Hi there, been using this for a number of years now, but never had to post a question - I guess most things are already answered - but this one is a bit more tricky.

    I want to calculate a totals and a weighted average based on months from a data set that has duplicate ID's and variable data (attached example).

    I would like to calculate the total tonnes by month and the average grade of those tonnes. Using the 'month ID table' as a reference to the 'Raw Data table'.

    Is this possible using if and vlookup functions or will require a higher level of programming knowledge??

    If you can please help
    Attached Files Attached Files
    Last edited by drdrez; 12-13-2008 at 10:15 PM. Reason: Solved

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try these formulas:

    I2:

    =SUM(IF(ISNUMBER(MATCH($A$3:$A$25,$E$3:$E$12,0)),$B$3:$B$25))

    J2:

    =AVERAGE(IF(ISNUMBER(MATCH($A$3:$A$25,$E$3:$E$12,0)),$C$3:$C$25))

    I3:

    =SUM(IF(ISNUMBER(MATCH($A$3:$A$25,$F$3:$F$12,0)),$B$3:$B$25))

    J3:

    =AVERAGE(IF(ISNUMBER(MATCH($A$3:$A$25,$F$3:$F$12,0)),$C$3:$C$25))

    each of these confirmed with CTRL+SHIFT+ENTER not just ENTER.

    Note: If you transpose the column/row headers in your summary, then it would be easier to enter the formulas once and copy them across the columns.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    12-13-2008
    Location
    Australia
    Posts
    12
    Works perfectly - Ill try and relate it to my actual data set and let you know how I get on

    Much appreciated

  4. #4
    Registered User
    Join Date
    12-13-2008
    Location
    Australia
    Posts
    12
    Actually how would I make that average a weighted average for the corresponding tonnes?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    you mean?

    =sum(if(isnumber(match($a$3:$a$25,$e$3:$e$12,0)),$b$3:$b$25*$c$3:$c$25))/sum(if(isnumber(match($a$3:$a$25,$e$3:$e$12,0)),$c$3:$c$25))
    confirmed with CTRL+SHIFT+ENTER

  6. #6
    Registered User
    Join Date
    12-13-2008
    Location
    Australia
    Posts
    12
    Perfect - I just tweaked it to be a weighted average of grade by tonnes rather that the other way around:
    =SUM(IF(ISNUMBER(MATCH($A$3:$A$25,$E$3:$E$12,0)),$B$3:$B$25*$C$3:$C$25))/SUM(IF(ISNUMBER(MATCH($A$3:$A$25,$E$3:$E$12,0)),B3:B25))

    Thanks for all your help


  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    No Problem

    Please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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