+ Reply to Thread
Results 1 to 7 of 7

Average of Smallest 6 values returning error

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Average of Smallest 6 values returning error

    Hello All, I can't seem to find a solution via the search so I thought I'd post my issue.
    I've exhausted all my knowledge plus what I could gather on google.

    Lets say I have a range of cells (C2:Q2) that are populated with a value via a formula. I'm then trying to take the average of the 6 smallest numbers in that range (if there are at least 3 values present). The formula works if there are 3 or less values present or 6 or more values present but it's struggling with 4 or 5 values present.
    My formula looks like this: =IF(COUNT($C2:$Q2)>3,AVERAGE(SMALL($C2:$Q2,{1,2,3,4,5,6})),$R2)
    If there are more than 3 values present then average the 6 lowest values, if 3 or less values than display the value in R2.
    The issue I'm running into is excel (version 2010) views the blanks (not empty) as #NUM.
    So my question is, how can I get it to calculate the average of the 6 smallest numbers ignoring the blanks or #NUM.
    Note: The range of cells C2:Q2 are blank... populated with a "" in the formula that fills those cells.

    Hope that makes sense and appreciate any assistance you can provide.

  2. #2
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Average of Smallest 6 values returning error

    Not tried this, but If the cells are not actually blank, and you only want to calculate values greater that three, use something like this?

    =if(COUNTIF(c2:q2,">0"))>3,average(small(COUNTIF(c2:q2,">0"),{1,2,3,4,5,6})),$R2)

    Ochimus

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

    Re: Average of Smallest 6 values returning error

    If you want to average the 6 smallest values then why don't you test and make sure there are 6 values to average:

    =IF(COUNT($C2:$Q2)>3

    =IF(COUNT($C2:$Q2)>=6
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Average of Smallest 6 values returning error

    Surely the problem is self-explanatory. You cannot get the average of the 6 smallest numbers if you only have 4 or 5. 3 or less numbers is not a problem as you ask it return R2. 6 or more numbers is also not a problem because you have at least 6 numbers to choose from. It doesn't matter which cells are blank. If you only have 4 or 5 non-blank cells, the formula won't work.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    04-08-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Average of Smallest 6 values returning error

    I certainly realize what the problem is, hence my question of how to generate a formula that gets around it.
    I've solved the issue by inserting the following formula.
    IF(COUNT($C2:$Q2)>3,
    IF(COUNT($C2:$Q2)=4, AVERAGE(SMALL($C2:$Q2,{1,2,3,4})),
    IF(COUNT($C2:$Q2)=5, AVERAGE(SMALL($C2:$Q2,{1,2,3,4,5})),
    AVERAGE(SMALL($C2:$Q2,{1,2,3,4,5,6})))),
    $R2)

    If anyone can think of an alternative that's a little cleaner, shorter and or better let me know.

  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: Average of Smallest 6 values returning error

    This array formula** is a few keystrokes shorter:

    =IF(COUNT($C2:$Q2)>3,AVERAGE(SMALL($C2:$Q2,ROW(INDIRECT("1:"&IF(COUNT($C2:$Q2)=4,4,IF(COUNT($C2:$Q2)=5,5,6)))))),$R2)

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Average of Smallest 6 values returning error

    Or

    =IF(COUNT($C2:$Q2)>=3,AVERAGE(IFERROR(SMALL($C2:$Q2,{1,2,3,4,5,6}),FALSE)),$R2)

    EDIT: That also requires Ctrl+Shift+Enter
    Last edited by shg; 04-21-2016 at 11:58 AM.
    Entia non sunt multiplicanda sine necessitate

+ 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. Returning Average value while excluding error values
    By Stromming in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-02-2014, 04:13 PM
  2. [SOLVED] Average the smallest 20 values of several sections of a list
    By Aso89 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-12-2014, 05:15 AM
  3. Error Handling #N/A with AVERAGE Function - Average of values in Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  4. Error Handling #N/A with AVERAGE Function - Average of values in Row
    By Don Guillett in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 09-06-2005, 11:05 AM
  5. Error Handling #N/A with AVERAGE Function - Average of values in Row
    By Don Guillett in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 09-06-2005, 07:05 AM
  6. [SOLVED] Error Handling #N/A with AVERAGE Function - Average of values in Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  7. Returning the Nth Largest / Smallest Values in a Range
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-29-2005, 07:53 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