+ Reply to Thread
Results 1 to 4 of 4

Average the Last Five Cells in a Column

  1. #1
    Warrior Princess
    Guest

    Average the Last Five Cells in a Column

    I have some numbers in a column and I want to take the average of the last
    five. If my numbers are in A1:A10 I know I can use the AVERAGE function:
    AVERAGE(A6:A10). But the problem is that some of the cells are empty.
    What I want to do is take the average of the last five cells in a column, so
    long as those cells have numbers in them. So if cell A7, for example, is
    empty, I would average A5:A10. If A7 and A8 are empty, I would average
    A4:A10. Is there any way that this is possible?



  2. #2
    Bob Phillips
    Guest

    Re: Average the Last Five Cells in a Column

    Here is a solution that Peo Sjoblom posted last year

    =AVERAGE(A65535:INDEX(A1:A65535,SUMPRODUCT(LARGE(ROW(1:65535)*(A1:A65535<>""
    ),C1))))

    C1 is a cell containing the number of cells to average, 5 in your case

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Warrior Princess" <[email protected]> wrote in message
    news:[email protected]...
    > I have some numbers in a column and I want to take the average of the last
    > five. If my numbers are in A1:A10 I know I can use the AVERAGE function:
    > AVERAGE(A6:A10). But the problem is that some of the cells are empty.
    > What I want to do is take the average of the last five cells in a column,

    so
    > long as those cells have numbers in them. So if cell A7, for example, is
    > empty, I would average A5:A10. If A7 and A8 are empty, I would average
    > A4:A10. Is there any way that this is possible?
    >
    >




  3. #3
    Warrior Princess
    Guest

    Re: Average the Last Five Cells in a Column

    Thank you!

    "Bob Phillips" <[email protected]> wrote in message
    news:%235Lxq%[email protected]...
    > Here is a solution that Peo Sjoblom posted last year
    >
    >

    =AVERAGE(A65535:INDEX(A1:A65535,SUMPRODUCT(LARGE(ROW(1:65535)*(A1:A65535<>""
    > ),C1))))
    >
    > C1 is a cell containing the number of cells to average, 5 in your case
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Warrior Princess" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have some numbers in a column and I want to take the average of the

    last
    > > five. If my numbers are in A1:A10 I know I can use the AVERAGE function:
    > > AVERAGE(A6:A10). But the problem is that some of the cells are empty.
    > > What I want to do is take the average of the last five cells in a

    column,
    > so
    > > long as those cells have numbers in them. So if cell A7, for example, is
    > > empty, I would average A5:A10. If A7 and A8 are empty, I would average
    > > A4:A10. Is there any way that this is possible?
    > >
    > >

    >
    >




  4. #4
    Jason Morin
    Guest

    Re: Average the Last Five Cells in a Column

    One way:

    =AVERAGE(OFFSET(A10,,,LARGE(IF(A1:A10<>"",ROW(1:10)),5)-
    ROWS(A1:A10)-1))

    While it works fine, the only downside is that OFFSET is
    a volatile function. INDEX should be the preferred
    function.

    HTH
    Jason
    Atlanta, GA


    >-----Original Message-----
    >I have some numbers in a column and I want to take the

    average of the last
    >five. If my numbers are in A1:A10 I know I can use the

    AVERAGE function:
    >AVERAGE(A6:A10). But the problem is that some of the

    cells are empty.
    >What I want to do is take the average of the last five

    cells in a column, so
    >long as those cells have numbers in them. So if cell A7,

    for example, is
    >empty, I would average A5:A10. If A7 and A8 are empty, I

    would average
    >A4:A10. Is there any way that this is possible?
    >
    >
    >.
    >


+ 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