+ Reply to Thread
Results 1 to 13 of 13

How to find within an array, and return AVG of certain cells

Hybrid View

  1. #1
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    How to find within an array, and return AVG of certain cells

    Note: Forgive my redundancy, I just posted a thread with the same content, but a different issue, so I figured this should be a new thread.

    So I have spreadsheet with 12 monthly tabs of employee performance. For example, the January tab has empID in column A, and "time to complete a certain task" in columns B-AZ. These tasks are grouped (without any empirical identifier) into 10 "parent groups". For example, columns B-C are "Group 1", columns D-J are "Group 2", etc...

    Not all employees work each month, so I have a summary tab that contains all possible empIDs in column A, and then 10 columns for each "parent group", for each month (column B-K are for Jan, J-n for Feb, etc...). The expected results for each cell is the AVERAGE of the groups' times, per month. For example, if the empID in A2 is within the Jan array (if they worked in Jan); B2 = AVERAGE of Jan, "Group 1" times; B3 = AVERAGE of Jan, "Group 2" times; et cetera for all 10 "groups", and then repeated for each month.

    I was able to achieve this in the summary tab, but only by inserting 10 new columns for each "group", in each month tab, that calculates those averages. I then just did a VLOOKUP for the empIDs and returned values if found: =IFERROR(VLOOKUP($A2,'January'!$C$4:$AW$250,6,FALSE),"-").

    Again, I have a solution in place, but it would be nice to not alter the raw data with new columns. With the way the data was initially formatted, is there a way to do a VLOOKUP that returns calculations (IF found, return AVERAGE(this cell:this cell)), instead of just a column reference (like "6" in the formula above)? Or should I abandon VLOOKUP altogether and go another route?
    Attached Files Attached Files
    Last edited by freerdj; 05-29-2013 at 03:53 PM. Reason: grammer

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: How to find within an array, and return AVG of certain cells

    could you send a sample?

  3. #3
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to find within an array, and return AVG of certain cells

    I should have specified: I would attach the spreadsheet but it contains sensitive data. I'll fiddle with it for a little bit to see if I can mask those fields without losing the references.

  4. #4
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: How to find within an array, and return AVG of certain cells

    blank them out!!! names and ids are not relevant as well as headers with company info.

  5. #5
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to find within an array, and return AVG of certain cells

    Tis attached.

  6. #6
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: How to find within an array, and return AVG of certain cells

    sorry but I don't see it

  7. #7
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to find within an array, and return AVG of certain cells

    Example_Stats.xlsx

    Attached on OP and here.

  8. #8
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: How to find within an array, and return AVG of certain cells

    You should look at averageifs()

  9. #9
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to find within an array, and return AVG of certain cells

    Thanks for the reply. I did look at that, but still not sure that would work; the figures to be averaged are all in the row corresponding to the empID, but they are not adjacent to one another.

    If empID is in column A, return average of [this][this][this] or [this:this], in the corresponding row.

  10. #10
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: How to find within an array, and return AVG of certain cells

    it worked!! the formula is looking for matching columns for the group in the corresponding month tab.

    I added columns E and P to form the range name. this can be avoided by adding the formula forming the range name to each cell too.
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: How to find within an array, and return AVG of certain cells

    the trick is to identify the row first and then average those figures in that row that correspond to the group..

    the reason that the id of the corresponding row has to be done first is that averageif only works in one direction at a time. either horizontally or vertically.

    i'll try to post your sample with my idea (hopefully working)

  12. #12
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to find within an array, and return AVG of certain cells

    That would be great, thanks. Yeah I hadn't heard of averageif until earlier this week, so it would really help me understand quicker with pertinent data. Can you do my homework for me?

  13. #13
    Registered User
    Join Date
    06-04-2009
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to find within an array, and return AVG of certain cells

    ha whoa. I've got meetings this morning, but when I can I'll spend time stepping through this one, which I'm sure I'll have questions. Thanks so much and schnazzy work.

+ 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