+ Reply to Thread
Results 1 to 4 of 4

Average of last n number of cells NOT including blank cells

  1. #1
    Registered User
    Join Date
    01-09-2012
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2007
    Posts
    54

    Average of last n number of cells NOT including blank cells

    Hi,

    I was wondering if someone knew a function that would be able to calculate the average of the last n number of cells (not including blank cells) in a column. The column would be growing on a daily basis and I would like a function that would automatically account for this so that nothing had to be changed manually. Also, as I've indicated, that column will contain blank cells. I would NOT want these cells being incorporated into the average calcuation. In my example, column A has a set of numbers and blanks. the average of the last three numeric cells is 96. Is it possible to get an equation that could do this and also adjust for data being added to the column. thanks.

    Dan
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: Average of last n number of cells NOT including blank cells

    Are you saying that you want to get the "last" value before the blank cell, and the 'n' values before the next blank cell and average them? In other words, continue from your example (see below)

    row11 - 90
    row12 - blank
    row13 - blank
    row14 - 10
    row15 - 10
    row16 - 10
    row17 - blank
    row18 - blank
    row19 - 10

    that means, the average will be 30 {(90+10+10+10) / 4}

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Average of last n number of cells NOT including blank cells

    Assuming data up to row 100 try this array formula

    =AVERAGE(INDEX(A2:A100,LARGE(IF(A2:A100<>"",ROW(A2:A100)-ROW(A2)+1),3)):A100)

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  4. #4
    Registered User
    Join Date
    01-09-2012
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: Average of last n number of cells NOT including blank cells

    the array formula worked perfect! Thanks!!

+ 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