Hi everyone,
I have tried to extract year and month and combine them. For a date such as 31/05/2017, I want to get the output as 2017_05. How can do that?
Thank you.
Hi everyone,
I have tried to extract year and month and combine them. For a date such as 31/05/2017, I want to get the output as 2017_05. How can do that?
Thank you.
With the date in A1, try
=YEAR(A1)&"_"&MONTH(A1)
or
=TEXT(A1,"yyyy\_mm")
This will change the date to Text format.
You can also change the formatting of A1 to Custom yyyy\_mm and keep the value as an Excel recognized date.
Last edited by 63falcondude; 06-02-2017 at 08:58 AM.
Sorry, I need VBA version. My mistake. I should have put this message in the VBA section.
MDate = Format(Mydate, "yyyy\_mm")
Thank you so much, Phuocam. It is very useful.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks