+ Reply to Thread
Results 1 to 9 of 9

Find the average of the lowest four values of the last six

  1. #1
    Registered User
    Join Date
    05-03-2010
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    1

    Find the average of the lowest four values of the last six

    I have a spreadsheet that holds values in a row. I want to look at the string of numbers, and find the average of the lowest four of the last six. Here is an example:

    45 43 47 42 47 47 45 38 45 47 44 41 39 39
    51 48 55 55 48 50 52 46 50 51 55
    46 43 45 44 47 39 39 42 42 43 48
    43 42 42 42 39 45 38 38 40 42 39 43 41 40
    52 57 54 55 57 53 57 49 57 51 59 61
    46 42 45 42 38 41 39 38 37

    For each of these rows, I need to find the average of the lowest four of the last six.

    Any advice??

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Find the average of the lowest four values of the last six

    Try this ARRAY formula

    =AVERAGE(SMALL(OFFSET($A$1,0,LARGE(IF(ISNUMBER($A1:N1),COLUMN($A1:$N1)),6)-1,1,6),{1,2,3,4}))
    Last edited by shg; 05-03-2010 at 06:27 PM. Reason: deleted quote

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Find the average of the lowest four values of the last six

    Give this a try:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Find the average of the lowest four values of the last six

    Tip of the hat to BOB...great formula.

    I had to tweak some of the $ signs out to so it copied down correctly:

    =AVERAGE(SMALL(OFFSET(A1, 0, LARGE(IF(ISNUMBER(A1:N1), COLUMN($A1:$N1)), 6) - 1, 1, 6), {1,2,3,4}))

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find the average of the lowest four values of the last six

    If you make the same assumptions re: contiguous data set and always 6 values then you could achieve the same I think per the below

    =AVERAGE(SMALL($N1:INDEX($A1:$N1,MATCH(9.99E+307,$A1:$N1)-5),{1,2,3,4}))

    confirmed with ENTER

    If you need to account for non-contiguous data sets and/or < 4 / 6 results then obviously the above (like Bob's) would require adaptation.

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Find the average of the lowest four values of the last six

    I did alloow for non-contiguous data Luke <g>

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find the average of the lowest four values of the last six

    Hi Bob,

    the starting point for the Average range would adjust for non-contiguous data points however the resulting range itself would not

    The Average range is hardwired to 1 x 6 from variable start point it follows that if any of the 5 subsequent data points were non-contiguous then in present form the Average would not be extracting 4 values from 6 numerics
    (there would be non-numerics interspersed within the 1 x 6)

    For the record I wasn't advocating my approach over yours - just illustrating an alternative based on similar assumptions.

  8. #8
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Find the average of the lowest four values of the last six

    Quote Originally Posted by DonkeyOte View Post
    For the record I wasn't advocating my approach over yours - just illustrating an alternative based on similar assumptions.
    I know, just re-iterating my defensive programming credentials (with a big grin).

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Find the average of the lowest four values of the last six

    And for the record, my macro doesn't account for blanks inside a row of data. Those formulas would be a much better choice.

+ 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