Convert Numbers to Date Format

GreyFox8991

New Member
Joined
Jul 20, 2022
Messages
21
Office Version
  1. 2016
Platform
  1. Windows
Greetings Excel Community,

I have numbers formatted in the following Text or general format: 20221026.. I am trying to format it as mm/dd/yyyy.... I have used a formula as follows but it is not generating the correct output: Formula is
=DATE(LEFT(G2|4)|MID(G2|5|3)|RIGHT(G2|2)). I am including a screenshot. Column "mm/dd/yyyy" is the result of the formula however, it is not displaying the Correct date which is in the "Correct Format" Column. Any insight would be appreciated!


1666812856966.png
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Here is a power query solution.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(Source, {{"Date", type text}}, "en-US"), "Date", Splitter.SplitTextByRepeatedLengths(4), {"Date.1", "Date.2"}),
    #"Split Column by Position1" = Table.SplitColumn(#"Split Column by Position", "Date.2", Splitter.SplitTextByRepeatedLengths(2), {"Date.2.1", "Date.2.2"}),
    #"Merged Columns" = Table.CombineColumns(#"Split Column by Position1",{"Date.2.1", "Date.2.2", "Date.1"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"New Date"),
    #"Changed Type" = Table.TransformColumnTypes(#"Merged Columns",{{"New Date", type date}})
in
    #"Changed Type"

DateNew Date
1952101610/16/1952
1950100310/3/1950
192803023/2/1928
2022102610/26/2022
 
Upvote 0
See if the following formula works for you:
Excel Formula:
=--TEXT(G2,"0000-00-00")
 
Upvote 1
Solution

Forum statistics

Threads
1,223,630
Messages
6,173,454
Members
452,514
Latest member
cjkelly15

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