+ Reply to Thread
Results 1 to 5 of 5

Generating Dates from Notation: Better Way?

  1. #1
    Registered User
    Join Date
    04-11-2012
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Generating Dates from Notation: Better Way?

    Basically, I'm trying to get the formula cell to spit out the date of the corresponding quarter end. The notation I'm following is F_Q__, where the first blank is one of the following set {1,2,3,4}. The second blank is the last two numbers of the fiscal year.

    With the notated cell (I5 in this case) directly above the formula cell (I6 in this case), I'm using the pasted below formula to generate the date of the quarter end. For example, "F1Q12" in the notated cell should generate "6/30/2011" in the cell below (i.e., the formula cell).

    =IF(LEFT(I5,2)="FY",MID(I5,3,4),DATE(IF(VALUE(MID(I5,2,1))<4,"20"&VALUE(MID(I5,4,2)-1),"20"&VALUE(MID(I5,4,2))),IF(VALUE(MID(I5,2,1))<4,6*VALUE(MID(I5,2,1))-(3*(VALUE(MID(I5,2,1))-1)),3),IF(OR(MID(I5,2,1)="3",MID(I5,2,1)="4"),31,30)))

    Luckily, this works for any subsequent notated cell, granted the notation is correct:

    F1Q22 yields 6/30/2021
    F4Q23 yields 3/31/2023
    etc., etc.

    My issue:

    This is a beastly formula--what is the more elegant solution?

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Generating Dates from Notation: Better Way?

    How about

    =EOMONTH(DATE(2000+RIGHT(I5,2),MID(I5,2,1)*3,1),-9)

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Generating Dates from Notation: Better Way?

    Or without EOMONTH?

    =DATE(1999+RIGHT(I5,2),MID(I5,2,1)*3+4,0)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Registered User
    Join Date
    04-11-2012
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Generating Dates from Notation: Better Way?

    These don't work because, for some reason, I can't do math operations on any reference functions like RIGHT, MID, LEFT, etc. Is this just me?

    Didn't know about EOMONTH function--thanks for trying to help out.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Generating Dates from Notation: Better Way?

    The formula works for me. Tested on the 3 examples you gave - correct results received.

+ 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