Forum Discussion
Pradip4854
Feb 05, 2023Copper Contributor
How To change date from 2022 to 2023 in xlsx
Please help me change date from 2022 to 2023
3 Replies
- NikolinoDEGold Contributor
As far as I could understand you only want to change the year in an existing date.
If this is so..then, I see two possibilities:
Example in A1 = 15.5.2022 is (entered) date.
Formula in B1
=DATE("2023",MONTH(A1),DAY(A1))
or alternative in B1
=DATE(YEAR(A1)+1,MONTH(A1),DAY(A1))
VBA can also be used if you convert the file to .xlsm, here is an example.
with VBA
Sub date_new() Dim Old, New As Date old="15.05.2022" New = DateSerial(Year(Alt) + 1, Month(Alt), Day(Alt)) MsgBox New End sub
Hope I was able to help you with this info.
I know I don't know anything (Socrates)
- karlacoder02Copper ContributorThanks for the help.
- Harun24HRBronze ContributorUse =TEXT(TODAY(),"YYYY")