Return current date for year

%3CLINGO-SUB%20id%3D%22lingo-sub-2404528%22%20slang%3D%22en-US%22%3EReturn%20current%20date%20for%20year%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404528%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20some%20help%20building%20a%20formula.%20I%20need%20to%20return%20the%20current%20year%20of%20a%20date%20in%20a%20cell%20in%20the%20YYYY-MM-DD%20format.%20For%20example%2C%20in%20one%20cell%20I%20have%201997-11-10%20and%20I%20need%20it%20to%20return%202021-11-10%20in%20another%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2404528%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2404592%22%20slang%3D%22en-US%22%3ERe%3A%20Return%20current%20date%20for%20year%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404592%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1068465%22%20target%3D%22_blank%22%3E%40catsrock1023%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20say%20the%20date%201997-11-10%20is%20in%20cell%20B2.%3C%2FP%3E%0A%3CP%3EThe%20formula%20you%20want%20is%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DDATE(YEAR(TODAY())%2CMONTH(B2)%2CDAY(B2))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2404650%22%20slang%3D%22en-US%22%3ERe%3A%20Return%20current%20date%20for%20year%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404650%22%20slang%3D%22en-US%22%3Ewhat%20if%20it's%20a%20string%20of%20text%3F%20i'm%20using%20this%20formula%20in%20a%20different%20program%20that%20supports%20the%20use%20of%20excel%20formulas.%20it%20uses%20the%20ISO%208601%20date%20but%20projects%20it%20as%20%22Nov%2011%2C%201997%22%3CBR%20%2F%3E%3CBR%20%2F%3EI%20tried%20the%20above%20formula%20with%20no%20success%2C%20I%20think%20something%20similar%20to%20this%3A%3CBR%20%2F%3ECONCATENATE(YEAR(TODAY())%2C%20%22-%22%2C%20TEXT(DATEVALUE(B2)%2C%20%22YYYY-MM-DD%22)%3CBR%20%2F%3Eshould%20work%20but%20is%20not%20working%20lol.%20any%20suggestions%20based%20on%20this%20info%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2404709%22%20slang%3D%22en-US%22%3ERe%3A%20Return%20current%20date%20for%20year%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404709%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1068465%22%20target%3D%22_blank%22%3E%40catsrock1023%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDo%20you%20mean%20that%20the%20cell%20(B2%20in%20this%20example)%20contains%20a%20text%20value%3F%20What%20do%20you%20see%20in%20the%20formula%20bar%20when%20you%20select%20that%20cell%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2404733%22%20slang%3D%22en-US%22%3ERe%3A%20Return%20current%20date%20for%20year%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404733%22%20slang%3D%22en-US%22%3Eit's%20difficult%20to%20explain%2C%20but%20i'm%20not%20using%20excel%20for%20this%2C%20just%20need%20an%20excel%20formula%20(%3CA%20href%3D%22https%3A%2F%2Fgeneralcaster.app%2Fwebsite%2Fdocumentation%2Fformula%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgeneralcaster.app%2Fwebsite%2Fdocumentation%2Fformula%2F%3C%2FA%3E%20is%20the%20app%20i%20am%20using)%3CBR%20%2F%3E%3CBR%20%2F%3Ethat%20doesn't%20really%20answer%20your%20question%2C%20i'm%20sorry!%3C%2FLINGO-BODY%3E
Occasional Contributor

I need some help building a formula. I need to return the current year of a date in a cell in the YYYY-MM-DD format. For example, in one cell I have 1997-11-10 and I need it to return 2021-11-10 in another cell.

 

Thank you in advance!

11 Replies

@catsrock1023

 

Let's say the date 1997-11-10 is in cell B2.

The formula you want is

 

=DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))

what if it's a string of text? i'm using this formula in a different program that supports the use of excel formulas. it uses the ISO 8601 date but projects it as "Nov 11, 1997"

I tried the above formula with no success, I think something similar to this:
CONCATENATE(YEAR(TODAY()), "-", TEXT(DATEVALUE(B2), "YYYY-MM-DD")
should work but is not working lol. any suggestions based on this info?

@catsrock1023 

Do you mean that the cell (B2 in this example) contains a text value? What do you see in the formula bar when you select that cell?

it's difficult to explain, but i'm not using excel for this, just need an excel formula (https://generalcaster.app/website/documentation/formula/ is the app i am using)

that doesn't really answer your question, i'm sorry!

@catsrock1023 

Perhaps in formula which @Hans Vogelaar suggested you shall use DATEVALUE(B2) instead of B2

=DATE(YEAR(TODAY()),MONTH(DATEVALUE(B2)),DAY(DATEVALUE(B2)))

That kind of worked, but I think there was an error because it needs to be in YYYY-MM-DD format. Any suggestions?

@catsrock1023 

Sorry, I don't know.

no worries, thank you for the help!

@catsrock1023 

I don't fully understand where the problem arises.  Excel formulas accept date serial numbers but with the DATEVALUE function it will also accept formats appropriate to the machine localisation which should include ISO standard dates.  So

= DATE( 2021, MONTH(DATEVALUE(B2)), DAY(DATEVALUE(B2)) )

should give a serial date that can be formatted.  As an alternative if the cycle is text to text one could use

= LET(
  old,  DATEVALUE(oldDate),
  mnth, MONTH(old),
  d,    DAY(old),
  current, DATE( 2021, mnth, d),
  TEXT(current,"YYY-MM-DD"))

@Peter Bartholomew 

That's not Excel, that is this app https://generalcaster.app/website/documentation/formula/ which uses formulas as in Excel, but not all and by bit different way.

Thanks. I had picked up that another system came into the picture but I (wrongly) assumed it was an import/export issue.