+ Reply to Thread
Results 1 to 2 of 2

Sum X Values of a range where X can change

  1. #1
    Registered User
    Join Date
    09-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Sum X Values of a range where X can change

    I am banging my head against the wall here. I recall seeing somewhere where this could be done, b ut can't find it again. Here is my problem:

    1) I would like to sum (or average) the top X numbers from a range.
    2) I realize that this can be done with the Large function and an array list, and I have done that, however, I would like more flexibility than that.
    3) Ideally, I would like to input a value for x in a cell and then the formula would refer to the value and select that many from the range.

    i.e. I have rows 5-20, each with 10 values. I would like to average the top 5 values of each row. I can enter 5 in cell C1 and it will return the average of the top 5 numbers for each row (think grade book with 10 assignments). So each student has an average grade based upon their best performance. Then, without changing any of the formulas, I just enter the number 7 in cell C1 and the averages now use the top 7 values instead of top 5 and I do not have to make any changes to the averaging formula at the end of each row.

    Anyway, if you could please point me in the right direction, I would appreciate it.

    Thanks :-) Have a great day.

    mark

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Sum X Values of a range where X can change

    =SUM(LARGE(A1:A10,ROW(INDIRECT("1:"&C1))))

    =AVERAGE(LARGE(A1:A10,ROW(INDIRECT("1:"&C1))))

    These are both array formulas, confirmed with Ctrl+Shift+Enter

    The A1:A10 is probably an incorrect range, but you can adjust it to whatever is applicable to your spreadsheet.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

+ 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. Replies: 1
    Last Post: 07-24-2013, 04:01 AM
  2. change values in a range when cell value is changed in that row
    By hattisaeed in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2011, 09:14 AM
  3. Replies: 1
    Last Post: 07-09-2011, 05:25 AM
  4. [SOLVED] How do I change a range of values from + to -?
    By Dave6 in forum Excel General
    Replies: 2
    Last Post: 05-15-2006, 08:55 AM
  5. [SOLVED] using If statement to change values in a range
    By arrow in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-29-2006, 08:25 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