+ Reply to Thread
Results 1 to 6 of 6

Using Average with VLOOKUP (maybe HLOOKUP) Help

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    McLean, Va
    MS-Off Ver
    Excel 2007
    Posts
    4

    Using Average with VLOOKUP (maybe HLOOKUP) Help

    Hello,

    I am trying to get the weighted average of values in several rows of a column in which there are several matches in the lookup column. For example, column A has price and column B has returns. If column A has four rows with the same price, I need to get the weighted average of the corresponding returns in column B. Here is a test formlua that I got to work with values across multiple columns, but cannot figure out how to get it to work across multiple rows.

    =AVERAGE(VLOOKUP($D$2,$A$2:$C$8,{2,3},FALSE))

    Any help would be greatly appreciated.

    Thanks

  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 Average with VLOOKUP (maybe HLOOKUP) Help

    =AVERAGEIF(A2:A8,D2,B2:B8) gives average of column B where column A equals D2. Is that what you mean?
    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
    08-22-2012
    Location
    McLean, Va
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using Average with VLOOKUP (maybe HLOOKUP) Help

    Yes - thanks. And that was beautifully simple.

  4. #4
    Registered User
    Join Date
    08-22-2012
    Location
    McLean, Va
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using Average with VLOOKUP (maybe HLOOKUP) Help

    Sorry - quick follow-up. How could I modify this to allow for a weighted average vs. straight average? So, aside from Price and Return, I would have a third column for volume which could impact the weighted average return.

    Thanks!

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

    Re: Using Average with VLOOKUP (maybe HLOOKUP) Help

    Perhaps something like:

    =Sumproduct(--(A2:A8=D2),B2:B8,C2:C8)/SUMIF(A2:A8,D2,C2:C8)

    Where C2 is your Volumn column....

  6. #6
    Registered User
    Join Date
    08-22-2012
    Location
    McLean, Va
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using Average with VLOOKUP (maybe HLOOKUP) Help

    Worked perfectly, thanks for all your help and quick replies.

+ 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