+ Reply to Thread
Results 1 to 8 of 8

average last x weeks of data, based on current week

  1. #1
    Registered User
    Join Date
    09-16-2010
    Location
    Moshi, Tanzania
    MS-Off Ver
    Excel 2003
    Posts
    4

    average last x weeks of data, based on current week

    Hi,
    I would appreciate some help with a problem i have on my spreadsheet.

    I have a column with week numbers (N58:N109) and a column with the number of items used per week (O58:O109). The weeks are from week 1 to week 52. the useage column automatically updates daily (it is linked).
    I also have todays weeknumber displayed in cell F1 (based on today's date).

    Is it possible to get the average of the last 8 weeks, based on todays week number?

    so for example this is week 37, i would want to see the average number of items per week from week 30 to the current week.

    and next week it would display from week 31-38 and so forth.


    I hope that is clear, thanks in advance for your help!

    Shifei

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: average last x weeks of data, based on current week

    Hi, you could try with a array formula, in F1 these the today's weeknumber

    =AVERAGE(IF((N58:N109>=F1-7)*(N58:N109<=F1),(O58:O109)))

    to be confirmed with control+shift+enter.

    Jambo,

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: average last x weeks of data, based on current week

    Hi,

    This (non volatile) formula should work for you

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    09-16-2010
    Location
    Moshi, Tanzania
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: average last x weeks of data, based on current week

    Thanks!
    Is there a way i can get it to not include zero entries? (some weeks there is no useage of an item). so still only the last 8 weeks, but not including zero entries.

    thanks again!

    Shifei

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

    Re: average last x weeks of data, based on current week

    Do you only have data for this year? What will happen when you get to next year, in week 1 or week 4, what data would you consider then?
    Audere est facere

  6. #6
    Registered User
    Join Date
    09-16-2010
    Location
    Moshi, Tanzania
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: average last x weeks of data, based on current week

    hi daddylonglegs

    yes, data is only for this year. i make a new file for each year. so week 52 is the last week of this year.

    shifei

  7. #7
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: average last x weeks of data, based on current week

    Hi, array formula (again) to be confirmed with control+shift+enter, hoping it helps you.

    =AVERAGE(IF((N58:N109>=F1-7)*(N58:N109<=F1)*(O58:O109<>0),(O58:O109)))

    Zeros or empty cells are not considered in the average.

    -------------------------------------------------------
    Alternative: not array formula:

    =SUMPRODUCT(((N58:N109>=F1-7)*(N58:N109<=F1)*(O58:O109)))/SUMPRODUCT(((N58:N109>=F1-7)*(N58:N109<=F1)*(O58:O109<>0)))
    Last edited by canapone; 09-16-2010 at 07:27 AM.

  8. #8
    Registered User
    Join Date
    09-16-2010
    Location
    Moshi, Tanzania
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: average last x weeks of data, based on current week

    perfect!

    thank you so much to all for your time and help!

    Shifei

+ 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