+ Reply to Thread
Results 1 to 8 of 8

Sum average or other lookup help

  1. #1
    Registered User
    Join Date
    07-10-2009
    Location
    Hudson, New Hampshire USA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Sum average or other lookup help

    Hello,

    I am trying to do a lookup based on multiple conditions, and I had been using a SUMPRODUCT formula to do this.

    Please Login or Register  to view this content.
    However, I have recently come to realize that in the Mags-Unit-Hour sheet that I am using as a source, there are some duplicates. So the SUMPRODCUT is doing what it is designed to do and summing the values of these duplicates, however this is not what I want. Is there any way to return say an average of all the values that match this criteria?

    If not what would be a lookup formula I could use to simply return the first instance rather than a sum of duplicates?

    Thanks for any help.
    Last edited by ndenaro; 08-03-2009 at 10:23 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sum average or other lookup help

    divide the result by the count
    so basicaly
    sumproduct((--(a1:a5=d1),--(b1:b5=e1),(c1:c5))/sumproduct((--(a1:a5=d1),--(b1:b5=e1))
    or to find first value
    =INDEX($C$1:$C$5, MATCH(D1 & E1, INDEX(A1:A5 & B1:B5, 0), 0))
    Last edited by martindwilson; 08-03-2009 at 08:34 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    07-10-2009
    Location
    Hudson, New Hampshire USA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Sum average or other lookup help

    Thanks this is working well. One more question. Is there any way I can get this formula to disregard values of 0 or 99? The zero's and 99's are entered into the table as sort of error or missing values, so they are messing up my average and they are not needed there.

  4. #4
    Registered User
    Join Date
    07-10-2009
    Location
    Hudson, New Hampshire USA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Sum average or other lookup help

    I should probably mention I am using your first method with the two sumproduct formulas

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sum average or other lookup help

    just add them in
    =SUMPRODUCT(--(A1:A5=D1),--(B1:B5=E1),--(C1:C5<>0),--(C1:C5<>99),(C1:C5))/SUMPRODUCT(--(A1:A5=D1),--(B1:B5=E1),--(C1:C5<>0),--(C1:C5<>99))
    Last edited by martindwilson; 08-03-2009 at 09:26 AM.

  6. #6
    Registered User
    Join Date
    07-10-2009
    Location
    Hudson, New Hampshire USA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Sum average or other lookup help

    Thank you again, one last thing should do it. What would I add in to also disregard blank cells? I tried setting C:C > 0 instead of <> 0, but that doesn't seem to do the trick.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sum average or other lookup help

    c:c<>"" should do it

  8. #8
    Registered User
    Join Date
    07-10-2009
    Location
    Hudson, New Hampshire USA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Sum average or other lookup help

    Great. I should have had that one myself. Thanks so much for all of your help it seems to be working well!

+ 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