+ Reply to Thread
Results 1 to 13 of 13

formula to return a year based on a date range

  1. #1
    Registered User
    Join Date
    10-18-2010
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    21

    formula to return a year based on a date range

    Hi

    I want to return a year based on a date that is in cell A2. The criteria is below. Once the formula which would be in b2 is correct I would copy it down to the other rows so that a year is returned based on the date in the cells in colum A.

    >30/06/2008 but <01/07/2009 = 2009
    >30/06/2009 but <01/07/2010 = 2010
    >30/06/2010 but <01/07/2011 = 2011
    >30/06/2011 but <01/07/2012 = 2012

    Any Help is much appreciated

    Thanks

  2. #2
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    30/06/2008 but <01/07/2009 = 2009
    I dont understand how 2009 is the answer. Are you just wanting to return the year of the date on the right?

  3. #3
    Registered User
    Join Date
    10-18-2010
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    21

    Re: formula to return a year based on a date range

    Hi,

    No i want to return a year based on the range of dates. The returned year is the financial year end. It may not be the actual year of the value in cell A2...does that make sense...sorry for confusing

  4. #4
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    So which ever year has the 1st of April in you want to return? Is that your financial year end? or is 1st of July your financial year end?

  5. #5
    Registered User
    Join Date
    10-18-2010
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    21

    Re: formula to return a year based on a date range

    our financial year ends on 30th of June. So 30/06/08 would be 2008, 30/06/09 would be 2009 etc...

    Thanks

  6. #6
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    I know how to do it checking for each range but I'm wondering if there is a way to do it dynamically for every year going forward.

    is 31/6/08 = 2009 then?
    Last edited by darknation144; 03-29-2012 at 05:31 AM.

  7. #7
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    =IFERROR(IF(MONTH(A9)>=7,YEAR(A9),IF(MONTH(A9)<6,(YEAR(A9)+1),(IF(DAY(A9)<=30,YEAR(A9))))),"Incorrect Date Entered")

    Try that
    Last edited by Vaibhav; 03-29-2012 at 06:35 AM.

  8. #8
    Registered User
    Join Date
    10-18-2010
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    21

    Re: formula to return a year based on a date range

    Quote Originally Posted by darknation144 View Post
    =IFERROR(IF(MONTH(A9)>=7,YEAR(A9),IF(MONTH(A9)<6,(YEAR(A9)+1),(IF(DAY(A9)<=30,YEAR(A9))))),"Incorrect Date Entered")

    Try that
    I think we are getting there and you have pointed me in the right direction. I have teaked it slightly as the result returned was out. I have tried this against various dates and it seems to pull through the correct year.

    =IF(MONTH(A1)>=7,YEAR(A1)+1,IF(MONTH(A1)<7,YEAR(A1),(IF(DAY(A1)<=30,YEAR(A1-1)))))

    I will do a bit more testing but if you see a problem with what I have done can you let me know please

    Thanks again

  9. #9
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    Yours seems to work sorry mine had a mistake in it. Glad I could help.

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

    Re: formula to return a year based on a date range

    This should be sufficient

    =YEAR(A1+184)
    Audere est facere

  11. #11
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    I have no idea how that works but wow impressive.

  12. #12
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: formula to return a year based on a date range

    Quote Originally Posted by darknation144 View Post
    is 31/6/08 = 2009 then?
    If you can find June 31 on a calendar in any year, I'd be glad to equate it with 2009.

  13. #13
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: formula to return a year based on a date range

    For his needs that logic is correct.
    If someone helped give them rep using the star button.

    If you have received a satisfactory solution please mark the thread solved. If not Fotis will come for you at night :P

+ 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