+ Reply to Thread
Results 1 to 11 of 11

Average of last 12 nonblank values in row

  1. #1
    Registered User
    Join Date
    04-18-2008
    Posts
    11

    Question Average of last 12 nonblank values in row

    Hi,

    I am in need of assistance!

    I am trying to create a sheet which averages the last 12 numbers in a row.

    The problems I am running into are:

    -Sometimes there are fewer than 12 numbers in a row
    -There are blank cells before, inbetween and after the ranges

    (If there are fewer than 12 entries, I just need the average of whatever is there)

    Many thanks

    Attached is a screenshot

    excelhours.PNG

  2. #2
    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 last 12 nonblank values in row

    What version of Excel are you using?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Average of last 12 nonblank values in row

    If this isn't what you need - please post an Excel sheet - not a screenshot... However, see column AD

    If you're using Excel 2003 or before - shout - as the error trapping phase won't work.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    04-18-2008
    Posts
    11

    Re: Average of last 12 nonblank values in row

    Excel 2010

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Average of last 12 nonblank values in row

    There's an error in my formula. Ignore it for a moment or two...

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Average of last 12 nonblank values in row

    Back again... Hopefully it's OK now.

    BtW, it's an array formula that must be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files

  7. #7
    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 last 12 nonblank values in row

    Try this array formula**:

    Assuming the end of range is cell Z2. Adjust to suit.

    =AVERAGE(Z2:INDEX(A2:Z2,LARGE(COLUMN(A2:Z2)*ISNUMBER(A2:Z2),12)-COLUMN(A2)+1))

    ** 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.

  8. #8
    Registered User
    Join Date
    04-18-2008
    Posts
    11

    Re: Average of last 12 nonblank values in row

    Thanks for the replies.

    Glenn's seems to work well and is much appreciated.

    I'll take a look at yours now Tony.

    This would have taken me hours on my own, very grateful to all!

  9. #9
    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 last 12 nonblank values in row

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Average of last 12 nonblank values in row

    Glad to have helped! It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.

  11. #11
    Registered User
    Join Date
    08-07-2015
    Location
    London,UK
    MS-Off Ver
    Office 2010
    Posts
    1

    Re: Average of last 12 nonblank values in row

    Thanks Glenn, works great!

+ 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. Highlight the 1st NonBlank Cell upto the last NonBlank
    By Jarvin24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2015, 12:11 AM
  2. pasting nonblank values into new workbook
    By mabm529 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-21-2012, 04:48 PM
  3. [SOLVED] How to count the number of nonblank cells which have values
    By BNCOXUK in forum Excel General
    Replies: 2
    Last Post: 10-31-2012, 07:36 PM
  4. Replies: 2
    Last Post: 12-22-2011, 07:05 PM
  5. [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, 10:05 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