+ Reply to Thread
Results 1 to 14 of 14

Rolling averages and sums for the year

  1. #1
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Rolling averages and sums for the year

    I'm working with the state department of air quality trying to track information on my generators, and now they're asking for rolling 12 month sums for runtime (and a few other things). Since this document is expected to last for years, track 200 generators run monthly, and have thousands of lines;, the equation also has to be simple enough that it doesn't break excel or use up the allocated memory for the program.

    I need to create a column with a formula which will look at Generator Name, run time, and date of run. So for any generator named "L100 B" it'll add those runtimes but only for the last twelve months (february 2017 to february 2018, march2018 to march 2019, etc).

    My sample excel sheet is 6 lines and 4 columns, with no calculations or conditional formatting, yet it's too big to upload so I've reproduced it below.
    The first three columns are my criteria, and the fourth column is what I need my output to be.




    Thank you (edited because I forgot to hit preview, I'm sorry for all the dots)

    edited again (13:48 EST) with new larger date range.
    Attached Files Attached Files
    Last edited by datacenterguy; 02-27-2020 at 02:48 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Rolling averages and sums for the year

    Welcome to the forum.

    Please update your user profile with the version of Excel that you are using.

    Instructions telling you how to upload your workbook are at the top of the page.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    Updated.

    As for the upload, I'm doing that. Scroll down to manage attachments. Opens the new window, I select my file to upload; then it tells me it's too large to process. 11,819kb.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Rolling averages and sums for the year

    We don't need the full dataset - read the instructions again. A sub-set of sample desensitised data is all we need.

  5. #5
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    Resampled my data to a new file, no formulas or anything, and now it's a small enough file.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    I've found this instruction: howtoexcel.org/general/running-totals/ (I'm new and can't post links)
    The bottom section "Power Query" might work, but it still doesn't seem to do the conditional thing I need, where it only adds to the running total for a given generator.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Rolling averages and sums for the year

    I looked but didn't understand your data. I think you've made the sample dataset too small now. There needs to be enough to demonstrate what you want and the logic - there is only one row (the last) where anything is different.

  8. #8
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    Extended the sample data.
    I've gotten the sumif command to work in column F, so it does a lifetime total for each generator in column C.

    edit1.
    Right now, changed sumif to sumifs so I can do multiple criteria.
    F4=SUMIFS( D$1:D4, B$1:B4, B4)

    Now looking at say column A.
    Using: ">="&DATE(2017,1,1), datecolumn, "<="&DATE(2017,12,31) the Running Total will get an increase if the date is within 2017.

    How can I change that so that it's say teh date in cell A4 up to a year prior?


    edit 2.
    My start date (12 months prior) can be formulated as =(edate(a4, -12))-day(a4)+1). If cell a4 is Aug 28 2017, then that command gives Aug 1 2016.
    However it's still not working to plug that into sumifs as a start date.
    Attached Files Attached Files
    Last edited by datacenterguy; 02-27-2020 at 02:15 PM.

  9. #9
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Rolling averages and sums for the year

    A
    B
    C
    D
    1
    Date
    Generator
    Run Time(hrs)
    Sample Rolling 12 month sum
    2
    4/30/2018
    L100 B
    8
    8
    3
    5/1/2018
    L100 A
    8.1
    8.1
    4
    5/1/2018
    L100 C
    8.1
    8.1
    5
    7/31/2019
    L100 B
    0.3
    0.3
    6
    8/23/2019
    L100 B
    0.4
    0.7


    D2=IF($A2<>"",SUMPRODUCT((YEAR($A$2:A2)=YEAR($A2))*($B$2:B2=$B2)*($C$2:$C2)),"")

    Copy down

  10. #10
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    Thank you Caracalla. I've actually added a larger range of data in a later post, I should've updated the OP.
    Your equation has been added, and it doesn't look right yet.

    It doesn't seem to go backwards past newyears though.
    I've added your equation to column F, then filtered it to show L112C.
    C3 had 8.2 hours. C13 had .5 hours. Since they're only six months apart, a 1 year running total should give 8.7, not the .5 it's showing.
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Rolling averages and sums for the year

    why is wrong ?
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    Line 11 for example is L112A dated Feb 5 2018, so it needs to include all relevant data points up to Feb 1 2017.

    For L112A, that's 4 entries, 2 of which don't have any runtime. 8.1, 0, 0, and .5. Your equation is great for a running total within a calendar year, doesn't go past new years eve.

  13. #13
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Rolling averages and sums for the year

    Attach the file with the results.
    I don't understand where the error is

  14. #14
    Registered User
    Join Date
    02-27-2020
    Location
    NOVA
    MS-Off Ver
    Excel for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 32-bit
    Posts
    32

    Re: Rolling averages and sums for the year

    Got it.
    =SUMIFS(D$1:D2, B$1:B2, B2, A$1:A2, ">="&((EDATE(A2, -12))-DAY(A2)+1) )

    I gotta say, I hate formatting sumifs if there's a date involved.
    Attached Files Attached Files

+ 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. [SOLVED] Match criteria (year) and obtain averages and sums
    By student789 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-05-2019, 03:12 AM
  2. [SOLVED] Rolling sums
    By odej98 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-31-2017, 04:11 AM
  3. [SOLVED] Year-to-Date Sums and Averages with different start dates
    By rachelglusk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-29-2015, 07:13 PM
  4. Replies: 4
    Last Post: 03-13-2015, 05:34 AM
  5. Filtering and averages, sums
    By Cmorgan in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 09-07-2014, 07:05 AM
  6. rolling averages
    By bradleyhanks in forum Excel General
    Replies: 12
    Last Post: 06-07-2007, 10:49 AM
  7. [SOLVED] Rolling sums
    By ChuckW in forum Excel General
    Replies: 1
    Last Post: 09-07-2005, 05:05 PM

Tags for this Thread

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