+ Reply to Thread
Results 1 to 11 of 11

Using vlookup with sum/average

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Using vlookup with sum/average

    Hi,

    Please help me with this. This is really urgent that i need to learn this. I really don't know how to use vlookup and sum/average function together.

    I already tried AVERAGE(VLOOKUP(A2,data!A$2:C$13,3,FALSE)), but it only returns the first value in the data tab.



    I was thinking that vlookup data should be placed in an array.. but don't know how... =(

    Pivot table is placed there only as reference as to see if calculations will be correct.

    Can someone please educate me on this.. I would really appreciate this. Thank you.
    Attached Files Attached Files

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

    Re: Using vlookup with sum/average

    Use these:

    =SUMIF(data!A$2:A$3,A2,data!C$2:C$13)

    and

    =AVERAGEIF(data!A$2:A$3,A2,data!C$2:C$13)
    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
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using vlookup with sum/average

    that works. Thanks. =)

    but is there any other methods, the assignment was to use the vlookup to get the sum/average.. given that if in the data table, joe1 was entered. . it would still be able to get the sum/average.. ..

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

    Re: Using vlookup with sum/average

    If there are going to be duplicated matches (i.e. name appears twice in same month) then vlookup won't work.... If there is only one appearance of the name per month, then you don't need to sum or average at all... so I am not sure what the issue is then.

  5. #5
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using vlookup with sum/average

    i mean, if we were to put a new data since this would be a running data. and the data inputed is (row 14: joe1, march 2011, 230).

    Is there a way where we could probably catch it in the calculation of the sum/average of joe.

    I apologize if Im not that clear. . .

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

    Re: Using vlookup with sum/average

    Use dynamic named ranges then: http://www.contextures.com/xlnames01.html#Dynamic

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Using vlookup with sum/average

    Or,

    You can use whole column reference.

    B2, copy down.

    =SUMIF(data!A:A,A2,data!C:C)

    C2, copy down.

    =IFERROR(AVERAGEIF(data!A:A,A2,data!C:C),"")

    B11, copy down.

    =SUMIF(data!B:B,">="&A11,data!C:C)-SUMIF(data!B:B,">"&EOMONTH(A11,0),data!C:C)

    C11, copy down.

    =IFERROR(AVERAGEIFS(data!C:C,data!B:B,">="&A11,data!B:B,"<="&EOMONTH(A11,0)),"")

    A11 to down, should be first day of the month.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

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

    Re: Using vlookup with sum/average

    The point was the OP was asking to sum or average results using VLOOKUP...

  9. #9
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using vlookup with sum/average

    still can't get it. . . Is there a way to capture all vlookup caputured data in an array?

    =VLOOKUP(A2,data!A$2:C$13,3,True) will read the name even if joe1 is entered, but if you where to arrange it in ascending order it only captures the closest value not the exact.

  10. #10
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: Using vlookup with sum/average

    No, Vlookup responds with the first instance of the array that matches the criteria.

    If the endgame of the equation is to obtain the average or sum or all situations where the conditions occur... then you'll need to go with the averageif or sumif equations. I believe you may be able to use wildcards in the Averageif or Sumif equations to reflect the variations on the fuzzy search between joe and joe1 which you would get with the "True" function at the end of the Vlookup.
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  11. #11
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using vlookup with sum/average

    ok. Thanks for the help guys. That means I have to go on and use wildcards...

    =SUMIF(name,A2&"*",prod)
    =IFERROR(AVERAGEIF(data!A:A,A2&"*",data!C:C),"")

    I did thought that lookup could be used to actualy be used to error check or something. .

+ 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