+ Reply to Thread
Results 1 to 17 of 17

Finding Oldest Year in a series of Dates then find value in row below last day of the year

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

    Finding Oldest Year in a series of Dates then find value in row below last day of the year

    This one is probably pretty simple for you people, but I cannot figure it out.

    Using the sample spreadsheet attached. I have a series of last days of a month, 60 in all cells 5A:5BH. Below those dates are dollar values.

    I want to figure out what the oldest year is on the series and put that year in cell 5BK. Then increment that cell by 1 year for cells 5BL:5BO then below that row put the value found below the day of the year 12/31/yyyy (6A:6BH) in row 6 into 6BK:6BO corresponding to the year in cells 5BK:5BO. The desired results are shown in the attached example.
    Attached Files Attached Files
    Last edited by Bobbbo; 11-02-2019 at 08:43 AM. Reason: Problem Solved

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    before that can be done you have a problem that your dates are text, if this is truly representative of your data your "dates" in row 5 aren't dates but text. if you want to convert them to dates, copy an empty cell then highlight A5:BH5 then hit paste special and click on Add and ok and they'll be converted to dates then format as you want.
    Still working on a formula for the rest.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    Thanks, I just pasted them as values and format from another workbook so there would be no links.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    so, do you know your oldest year in the series or does that need to be calculated? Because if you already know your oldest year then that is a different formula than a formula to determine what year is the oldest in the list?
    For example, if I'm just trying to give you a sum of all the 2014 year values in row 6 then I'd use a sumproduct formula but if I have to figure out what the oldest year is in the list then I'd probably use a min/if formula.
    in other words, are you looking to populate BK5 with the oldest year OR are you looking to populate BK6 with the sum of values FOR the year in BK5?

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    There is no summing of the values. I just what the number below the last day of the year i.e. 12/31/2015. I did realize that the oldest year will always be in the first column so I believe =YEAR(A5) will do the trick for cell 5BK then I will need a formula to add 1 year to 5BL:5BO. Below 5BK I want the value to be what is under 12/31/2014.

    Is that clearer?

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    yes, much clearer. I have to work on a different formula.

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    Hi Sambo kid, If you have a formula to add them all up for the year in cell 5BK:5BO, I need that as well for another application so you can share that with me if you have it that could be in cell 7BK:7BO

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    I had this sumproduct formula that would return the value for each year in BK5 through BO5... =SUMPRODUCT((YEAR($A$5:$BH$5)=BK5)*($A$6:$BH$6))

    But, for your problem as you outlined it in post #5, if the values in cells BK5 through BO5 were changed to the end of each year, like 12/31/2014 and 12/31/2015 but formatted to look like years it would be a simple hlookup to return the year end value. HOWEVER that would make the above sumproduct ineffectual because that uses year and not individual date. something like a helper row starting with 12/31/2014, then in the next column =EDATE(BK4,12) and drag it right (I started it in BK4).
    then this for the lookup... =HLOOKUP(BK4,$A$5:$BH$6,2,FALSE) and dragged right would work.

    Still thinking about a max and an offset or some other combination.

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    as a follow up to post #8, I find helper cells to be... very helpful (yes redundant). Some people frown on them because they are looking for elaborate all in one formulas but I find them invaluable. I often use them as it quite often simplifies the downstream formulas. AND, if I would be worried about it being seen, I just change the font color to the same as the cell background color (white in most cases) and they become invisible.
    Still thinking about a different other formula for now though. Maybe in the mean time someone else will stop by with a different formula.

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    I have no issue with "Helper" cells that have formulas in them. The final product will ultimately be a graph or chart so making the worksheet look pretty does not mater.

  11. #11
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    See if the following works for you:

    Cell BK5 ..... =YEAR(A5)
    Cell BL5 ..... =BK5+1 and drag-copy to the right
    Cell BK6 ..... =HLOOKUP("Dec 31, "&MOD(BK$5,100),$A$5:$BH$6,2,0) and drag-copy to the right

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    Hi Root_, It should work but I am getting a value of "Jul 6, 1905" in Cell BK5 with the formula =YEAR(A5). Is there a formatting issue??

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    Root and Sambo kid, I cannot seem to get the results I expected. I am getting a #N/A error. I rebuilt the spreadsheet (Attached) to represent exactly the worksheet I am working on to find the value on the last day of the year. I corrected the format row 6 to be a date so the calculation of YEAR(A5) works correctly to find the year then increment the year by 1 for each column to the right. The format for the date is now mm/dd/yy so I changed the formula to "12/31"&MOD(BK5,100) which results in what I want in row 12, but when I add the HLOOKUP function in row 7 it results in #N/A.

    What is wrong???
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    =hlookup(date(bk5,12,31),$a$5:$bh$6,2,0)

    you know the day is 31
    the month is 12
    so the year is the only bit than needs to change

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

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    WOW it worked davsth, Thanks. Why didn't my formula work? Also on my actual spreadsheet YEAR(A5) results in "1905" even though your formula result in the correct result?

  16. #16
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    Another solution.

    BK5
    Please Login or Register  to view this content.
    Press Ctrl-Shift-Enter for Array formula

    BK6
    Please Login or Register  to view this content.
    copy to right side as you want


    Regards.

  17. #17
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Finding Oldest Year in a series of Dates then find value in row below last day of the

    To make good use of spreadsheets, one of the fundamental things to get your head round is the difference between text and dates.
    Dates are the number of days since 1900, ands as such you can take one date away from another and find the days difference etc. You could format them as a number and they would change to a number
    Text is as it says text, if you format it nothing happends as it is just text
    "12/31"&MOD(BK5,100) returns text, it might look like a date, but it is text, formating it has no effect


    For example 31st Dec 2018 is a number 43465 this is how you have entered your headings that you match against, 12/31/18 as text does not equal 12/31/18 as a date hence your formula gives an error.


    This is one of the reasons attachments are helpful to solve questions, as looking at an image or a description, does not show how data has been enter

+ 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. Find dates in current year and previous year delete rows.
    By kreiner2006 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2019, 05:13 PM
  2. Replies: 3
    Last Post: 01-24-2019, 11:00 AM
  3. [SOLVED] countifs to find the total count between this year and last year for series of data
    By maher2014 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2016, 02:39 AM
  4. Replies: 1
    Last Post: 01-01-2016, 04:33 PM
  5. Replies: 0
    Last Post: 11-23-2012, 01:27 AM
  6. Finding Leap Year between 2 dates
    By Boomerj2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2010, 09:52 AM
  7. Replies: 7
    Last Post: 11-12-2008, 04:13 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