+ Reply to Thread
Results 1 to 5 of 5

Change code based on last day of year and change date based on code.

  1. #1
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    391

    Change code based on last day of year and change date based on code.

    I have a spreadsheet with codes and dates. I would like the date to change based on the code and the code to change if the date is > the last day of each year. I have attached a practice file.
    Attached Files Attached Files
    Last edited by Wskip49; 07-09-2012 at 12:03 PM. Reason: File did not attach

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,604

    Re: Change code based on last day of year and change date based on code.

    Can't see any attachment.

    Pete

  3. #3
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    391

    Re: Change code based on last day of year and change date based on code.

    I when back and reattached the file. Sorry it did not work the first time. I've tried Vlookup formula but I would have to change each year.
    Last edited by Wskip49; 07-09-2012 at 12:54 PM. Reason: Need to add more information.

  4. #4
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Change code based on last day of year and change date based on code.

    So it looks like the
    date = VLOOKUP(code)
    Is fine, no problem? Anyway the cells beneath (A3:A5 etc) don't make much sense to me.

    Probably... I don't understand the logic fully, but I'm guessing you want something like,

    code = "VA-"&RIGHT(YEAR(TODAY()),2)

    That will return the text string "VA-" with the two-year date for now attached. You can bury that in an IF conditional if you want, something like,

    code = "VA-"&IF(date_check > date_ref, Right(Year(Today()) - 1, 2), Right(Year(Today()),2)

    Anyway, that's the direction I'd go if I was the King of Space.

  5. #5
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    391

    Re: Change code based on last day of year and change date based on code.

    Thanks, I guess I did not explain my problem well enough. I tried your suggestion but could not get it to do what I wanted it to do. Sorry I for the waste of time. Thanks again.

+ 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