Convert the dd/mm portion in dd/mm/yyyy format to yyyymm format

pacerfan07

New Member
Joined
Jun 2, 2017
Messages
20
Hi,

I'm trying to convert a date that's typed as "11/12/2018" into "201211". So I want to drop the year, convert the 12 into 2012, move it to the front, and follow it with the 11.

Some of the dates have less digits. For example 7/15/2018 would need to become 201507.

Thanks!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Is your typed entry entered as Text or Date?
If you are unsure, try this formula (for an entry in cell A1):
=ISNUMBER(A1)

If it returns TRUE, you have a valid date entry (dates are really numbers in Excel).
If it returns FALSE, you have a text entry.

If you have a valid date entry, you can simply change the cell format to "yyyymm" to get it to display the way you want.
Or, if you want it to appear in another cell as Text, you can use the formula:
=TEXT(A1,"yyyymm")

If it is a text entry, you can use the formula:
=TEXT(DATEVALUE(A1),"yyyymm")
 
Last edited:
Upvote 0
Thanks for the reply. The entry is a valid date entry. However, your formula converts 11/12/2018 into 201811. I need to somehow disregard the 2018 on the end. I should have phrased the question this way: I'm just concerned with the first couple digits 11/12. I want to then turn the 11/12 into 11/1/2012 if possible. Another example would be to turn 7/15/2018 into 7/1/2015.
 
Upvote 0
Another example would be to turn 7/15/2018 into 7/1/2015.
So, do you just want to get the first day of that particular month?
You can simply use the formula:
Code:
=DATE(YEAR(A1),MONTH(A1),1)
and then choose any date format you want.
 
Last edited:
Upvote 0
The way im reading it you want one of these maybe:

=DAY(A1)*100+MONTH(A1)+200000
=DATE(20&DAY(A1),MONTH(A1),1)
 
Upvote 0
I was thrown off by your title.

Convert the dd/mm portion in dd/mm/yyyy format to yyyymm format
You really don't want "yyyy" in your format.
So, that "20" in your format just appears to be some static number, not representative of anything from the date itself.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,189
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top