+ Reply to Thread
Results 1 to 8 of 8

top 5 average

  1. #1
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    top 5 average

    Hi All,

    I have two formulas here that can do the top 5 average

    =IFERROR(AVERAGE(LARGE(A:A,{1,2,3,4,5})),AVERAGE(A:A))
    or
    =IFERROR(AVERAGE(LARGE(A:A,ROW(OFFSET(A1,,,5)))),AVERAGE(A:A))
    The second formula is an Array formula and must be entered with a Ctrl Shift Enter

    But the second formula I am having a bit of trouble understanding.

    How does Row(Offset) work? I also tried locking A1 So it is ROW(OFFSET($A$1... but this gave me a different answer to my average and I am confused why.

    I understand the first one but the second one I am a bit confused on.

    Thank you very much.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: top 5 average

    This bit of the formula:

    LARGE(A:A,ROW(OFFSET(A1,,,5)))

    resolves to this if you run it through the evaluate formula wizard:

    LARGE(A:A,{1,2,3,4,5})

    It's just another way of telling Excel to look at the top five numbers in the array. OFFSET is using the height parameter to tell Excel that it needs to look at five rows, but this is simply a way of establishing the array. If you used this:

    LARGE(A:A,ROW(OFFSET(A5,,,5)))

    it would resolve to this:


    LARGE(A:A,{5,6,7,8,9})
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: top 5 average

    Hi Ali,

    I see, I just pressed F9 on that portion and it turned out to be {1,2,3,4,5}. So basically in column A1:A10 I just listed down 1,2,3,4,5,6,7,8,9,10 and if I press enter for the formula Row(Offset) it returns 10 but if I use ctrl shift enter it returns 8 <-- which is the correct answer.

    I think it must be the array part of the formula but how does that affect the outcome?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: top 5 average

    Run the formula through the evaluate formula wizard with the formula first entered as an array formula (CTRL+SHIFT+ENTER) and then again when not, and you will see the difference it makes. The clue is in the name: array formula.

    HINT: You are looking at what ROW(OFFSET(A1,,,5)) resolves to.
    Last edited by AliGW; 12-04-2016 at 04:14 AM.

  5. #5
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: top 5 average

    I just did the evaluation without {} it becomes 1, but with it becomes {1;2;3;4;5}

    I tried to remove the row(offset) portion so =ROW(OFFSET(A1,,,5)) and use this as a stand alone formula but when I use the wizard it returns 1 in both instances. So confusing :[

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: top 5 average

    But you can see how the outcome changes as part of the larger formula, yes? If so, then you can manipulate it in future for your own needs. Once it's within the AVERAGE formula it behaves differently. I'm not sure I understand what is confusing you.
    Last edited by AliGW; 12-04-2016 at 04:26 AM.

  7. #7
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: top 5 average

    Ohhhhhhhhhhhhh I think I get it *mini light bulb* thank you Ali for all the help.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: top 5 average

    You're very welcome!

+ 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. SumProduct N/A Error, Quarterly Average, Running Average, From and to Userform
    By Sorjas in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-18-2015, 07:40 PM
  2. [SOLVED] need formula to average cells but if one cell has N/A then dont average and input N/A
    By CityInspector in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2013, 04:16 PM
  3. [SOLVED] Find Average, Return Column Header of Number Closest To Average
    By djmyers in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-07-2013, 04:19 PM
  4. Replies: 14
    Last Post: 06-14-2013, 09:00 PM
  5. displaying numbers whoes average is as close prefered average.
    By aakhan107 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-18-2012, 01:14 AM
  6. The rank of average ranks excluding empty cells but including their average.
    By Terminal45 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2012, 03:44 AM
  7. Replies: 5
    Last Post: 06-19-2012, 04:37 PM

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