+ Reply to Thread
Results 1 to 12 of 12

Help in getting the AVERAGE by using VLOOKUP and ARRAY

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2014
    Location
    Abu Dhabi
    MS-Off Ver
    2010
    Posts
    7

    Help in getting the AVERAGE by using VLOOKUP and ARRAY

    hi! i'm trying to take the average of the Salary(Column C) for every Category(Column A) with respect to Duration(Column D) as shown below.

    To get the average of Category A, my formula will look like this:
    =(C2*D2)/SUM($D$2:$D$5)+(C3*D3)/SUM($D$2:$D$5)+(C4*D4)/SUM($D$2:$D$5)+(C5*D5)/SUM($D$2:$D$5)


    Attachment 355377

    Attachment 355377

    now, the problem is if i'm going to insert another row, i need to revise the formula everytime.

    can someone help me to use maybe VLOOKUP and then make it loop to achieve what i want? so that even if i insert another row, it will just add that row to the formula since it uses VLOOKUP?

    then, i can remove Columns E & F and replace it with that formula.

    thanks for your help!
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by wilpy; 11-04-2014 at 10:39 AM. Reason: Solved

  2. #2
    Registered User
    Join Date
    10-30-2014
    Location
    Abu Dhabi
    MS-Off Ver
    2010
    Posts
    7

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    Thanks for the welcome.

    I've amended the title but i couldn't seem to upload the picture. so, I attached the file...

  3. #3
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    hI, tRY

    Formula: copy to clipboard
    =SUMPRODUCT(--(B2:B23=B2),C2:C23*D2:D23/SUMIFS(D2:D23,B2:B23,B2))
    Click just below left if it helps, Boo?ath?

  4. #4
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    Hi, Refer the attachment with cell references fixed...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-30-2014
    Location
    Abu Dhabi
    MS-Off Ver
    2010
    Posts
    7

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    Thank you very much boopathiraja!

    i just have one question, what does "--" mean?

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    Quote Originally Posted by wilpy View Post

    i just have one question, what does "--" mean?
    See this...

    http://xldynamic.com/source/xld.SUMPRODUCT.html
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    10-30-2014
    Location
    Abu Dhabi
    MS-Off Ver
    2010
    Posts
    7

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    thanks for the link tony... i learned a lot...

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    You're welcome. Thanks for the feedback!

  9. #9
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    Hi, thanks for the kind feedback and glad to help

  10. #10
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    Hi, to covert the results that is trues to 1 and false to 0,

    We can avoid if you put it in single array like this one will also work

    Formula: copy to clipboard
    =SUMPRODUCT(($B$2:$B$23=$B2)*$C$2:$C$23*$D$2:$D$23/SUMIFS($D$2:$D$23,$B$2:$B$23,$B2))

  11. #11
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY


  12. #12
    Registered User
    Join Date
    10-30-2014
    Location
    Abu Dhabi
    MS-Off Ver
    2010
    Posts
    7

    Re: Help in getting the AVERAGE by using VLOOKUP and ARRAY

    thank you again boopathiraja!

    i was struggling with this... i never thought that the formula would be that short and simple... wow! you're amazing... i'll now try to incorporate this in my file where the duration is in another sheet...

    i'll just use vlookup for the duration.... thanks again!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Populate one array from another array and print new array as a range
    By Kaden265 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2014, 07:52 AM
  2. Loop new messages containing a table, populate a dynamic array, paste array to Excel
    By laripa in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 07:20 AM
  3. [SOLVED] Quick Array question - Copy array to another array then resize?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-02-2013, 01:17 AM
  4. [SOLVED] Populate Listbox with all rows of a dynamic array where elements of a single array match.
    By Tayque_J_Holmes in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-07-2012, 04:54 AM

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