+ Reply to Thread
Results 1 to 17 of 17

Formula to add up data for 1 year automatically

  1. #1
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Formula to add up data for 1 year automatically

    I always have trouble dealing with dates in Excel. For those that don’t this should be easy. The attached spread sheet has columns of data with each column represented by a date in row 4. I want to total the data for the whole year knowing that the last dated column will not be the end of the current year. In this case the year is 2016. I want a formula that looks at the last column, cell BB4, and determine the year, then have a formula that can calculate going back 3 years to add up the data for 2016 (from cell BB4) minus 3 years which equals 2013 then add up the data from 1/31/2013 through 12/31/2013 in the 2013 column, cell BD5. The formula will go in cell BD5. Then do the same for minus 2 years (2014), and 1 year (2015) for each item 1 through 3. I also what the cell BD4, BE4 and BF4 to have a formula that calculates the date based on the year in BB4. Then do the same for the other rows 6 and 7. I have the formula that I created manually in column BD, BE and BF just to illustrate what is needed.
    Attached Files Attached Files
    Last edited by Bobbbo; 12-01-2016 at 06:02 PM. Reason: Mark it solved

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    In BD5

    =SUMPRODUCT(($F5:$BB5)*(YEAR($F$4:$BB$4)=BD$4))

    copy across and down

    OR

    =SUMIFS($F5:$BB5,$F$4:$BB$4,">=01/01/" &BD$4,$F$4:$BB$4,"<=31/12/" &BD$4)

  3. #3
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    It works great using the first formula. Thank you so much. What formula do I use to populate the year in cells BD4, BE4 and BF4?

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    try

    in BF4

    =IF(MONTH(LOOKUP(9999999,F$4:BB$4))=12,YEAR(TODAY()),YEAR(TODAY())-1)

    This checks if month of the last date i.e in BB4 is 12: if it is, set year=current year otherwise set to current year -1

    in BE4

    =BF4-1

    in BD4

    =BE4-1 (Or BF4-2)

  5. #5
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    Hi John, While waiting for your response I came up with this that is simpler. for cell BD4 =(YEAR($BB$4))-3, then BE4 =(YEAR($BB$4))-2 and then BF4 =(YEAR($BB$4))-1.

    Do you see any issue with this formula?

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    What happens when BB4 is 31/12/2016? Do you want years 2016, 2015, 2014 or 2015, 2014, 2013: your solution would give the latter. If you are OK with this, then use your formula.

  7. #7
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    Do you mean 12/31/2016, if so I put that in cell BB4 and still get 2013, 2014 and in cells 2015 BD4 through BF4. Am I missing something?

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    If you decide to go my way then this is correct:

    =IF(MONTH(LOOKUP(9999999,F$4:BB$4))=12,YEAR(BB4)),YEAR(BB4)-1)

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    what I am saying if you have full year's data ending with 31/12/yyyy in BB4 then (in my view) YYYY should be date in BF4. See my previous post.

    You know what you want!!!
    Last edited by JohnTopley; 12-01-2016 at 05:55 PM.

  10. #10
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    Now I see what you mean. I tried your formula in BD4 and I get an error.

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    See attached: formula in BH4
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    Great I have it working. There were few parenthesis that were in the wrong place. Again thanks for all your help!

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    You are very welcome,

  14. #14
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    Hi John, Since you knew the answer to my last question so easily, can you adapt your formula so that instead of adding up the whole year, it just returns the value in the column for the last day of that year i.e. 12/31/2103?

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,769

    Re: Formula to add up data for 1 year automatically

    Try

    =INDEX($F5:$BD5,MATCH(DATE(BD$4,12,31),$F$4:$BB$4,0))

  16. #16
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    WOW you are great, just what I needed. Thank You, Thank You Thank You

  17. #17
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    405

    Re: Formula to add up data for 1 year automatically

    John, WOW that works great. Thank You, Thank You, Thank You!!

+ 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. Replies: 1
    Last Post: 01-07-2016, 03:40 PM
  2. How change cell year dates to automatically update to new year
    By RonRich in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2015, 08:29 AM
  3. Automatically update year interval cycles from year to year
    By trumptight in forum Word Programming / VBA / Macros
    Replies: 8
    Last Post: 08-21-2014, 10:38 PM
  4. Need formula to average daily data into month and year data
    By phantasm79 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-28-2014, 07:02 PM
  5. [SOLVED] What formula to use to have excel continue a year automatically?
    By Excel-erate in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2013, 10:31 AM
  6. [SOLVED] Formula to automatically figure out the first friday of a specified month and year
    By darchaf in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-28-2012, 07:57 PM
  7. [SOLVED] Formula to automatically figure out year
    By darchaf in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-28-2012, 05:01 PM

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