+ Reply to Thread
Results 1 to 8 of 8

AVERAGE last 14 entries in a column

Hybrid View

  1. #1
    Registered User
    Join Date
    12-14-2008
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    73

    AVERAGE last 14 entries in a column

    My column C, I add a new cell every day, so, it expands deeper by 1 every day. I want a formula for the last 14 days of entries in Col C. I found this but can't figure it out...

    =AVERAGE(OFFSET(INDEX(2:2,,COUNT($A$2:$L$2)),,-9,1,10))
    (The above was on the web, does not pertain to my sheet.)

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: AVERAGE last 14 entries in a column

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Manually add some results and if it's not blindingly obvious how you have arrived at them some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: AVERAGE last 14 entries in a column

    if it is a simple 14-day rolling average, with your data un column A, wouldnt thisformula, copied down, work for you?

    =IF(A18="","",AVERAGE(A5:A18))

    the =IF(A18="","", will hide the answer if there is no value in A18 yet
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: AVERAGE last 14 entries in a column

    This formula seems to work and gives you the average of the last 14 values in a column.
    Assuming your data is in column A:
    =IF(COUNTA(A:A)<14,0,AVERAGE(INDIRECT("A"&COUNTA(A:A)):INDIRECT("A"&COUNTA(A:A)-13)))

  5. #5
    Registered User
    Join Date
    12-14-2008
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: AVERAGE last 14 entries in a column

    Quote Originally Posted by xLJer View Post
    This formula seems to work and gives you the average of the last 14 values in a column.
    Assuming your data is in column A:
    =IF(COUNTA(A:A)<14,0,AVERAGE(INDIRECT("A"&COUNTA(A:A)):INDIRECT("A"&COUNTA(A:A)-13)))
    Cool, thanks for that. It appears to work but I am curious as to why it does not agree exactly with an AVERAGE formula using the actual range. If I use...

    =AVERAGE(C47:C60)

    ...the results is .113. Using your formula, result is .114. (My data is in Col C, not Col A.)

    P.S. How can I make a formula where I want it start at a call and then use everything below that? If I want to do, say, an AVERAGE, I could say AVERAGE(C:C) and that would all in the column, right? What if I want to start at, say, C5 and then everything below that? I know this has got to be simple.

    attached
    Attached Files Attached Files
    Last edited by livemusic; 08-12-2012 at 02:33 PM.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721

    Re: AVERAGE last 14 entries in a column

    xLJer's formula works on the basis that column C is continually populated until the data ends.....but because you have blanks in C1:C3 it isn't averaging the correct range, it misses the bottom 3 values (so averages C44:C57 in your example).

    This formula will average the last 14 values assuming you have at least 14 in there (even if there are gaps before the data - but assumes continuous data after that)

    =AVERAGE(OFFSET(INDEX(C:C,MATCH(9.9E+307,C:C)),0,0,-14))

    If you might have less than 14 values then you can add an IF function to cope with that, i.e.

    =IF(COUNT(C:C)<14,AVERAGE(C:C),AVERAGE(OFFSET(INDEX(C:C,MATCH(9.9E+307,C:C)),0,0,-14)))

    Note that I used AVERAGE(C:C) in there, I think that answers your last query. You can average the whole column even when you only have numbers from C5 because the text values and blanks in C1:C4 will be ignored by AVERAGE function
    Audere est facere

  7. #7
    Registered User
    Join Date
    12-14-2008
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: AVERAGE last 14 entries in a column

    Quote Originally Posted by daddylonglegs View Post
    xLJer's formula works on the basis that column C is continually populated until the data ends.....but because you have blanks in C1:C3 it isn't averaging the correct range, it misses the bottom 3 values (so averages C44:C57 in your example).

    This formula will average the last 14 values assuming you have at least 14 in there (even if there are gaps before the data - but assumes continuous data after that)

    =AVERAGE(OFFSET(INDEX(C:C,MATCH(9.9E+307,C:C)),0,0,-14))

    If you might have less than 14 values then you can add an IF function to cope with that, i.e.

    =IF(COUNT(C:C)<14,AVERAGE(C:C),AVERAGE(OFFSET(INDEX(C:C,MATCH(9.9E+307,C:C)),0,0,-14)))

    Note that I used AVERAGE(C:C) in there, I think that answers your last query. You can average the whole column even when you only have numbers from C5 because the text values and blanks in C1:C4 will be ignored by AVERAGE function
    Thanks much to you and everyone else.

    What is the "9.9E+307" part, what does that signify?

    How can I make a formula to average everything in Col C except to exclude the first entry? (First entry is in C6.)

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721

    Re: AVERAGE last 14 entries in a column

    9.9E+307 is just about the biggest number you can enter in a cell in Excel, to find the last number in a column you can use a lookup with that value as the lookup value, e.g. for last number in ciolumn C

    =LOOKUP(9.9E+307,C:C)

    or to find the position of that value you can use MATCH the same way - that's what I did in the suggested formula.

    To average everything after C6 you could simply use a row much larger than you'll ever need, e.g.

    =AVERAGE(C6:C10000)

    or to explicitly get the last value

    =AVERAGE(C6:INDEX(C:C,MATCH(9.9E+307,C:C)))

+ 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