Convert inconsistent dates in General format to specific date format

Nola111

Board Regular
Joined
Aug 28, 2013
Messages
119
Is there one formula that could be used in all of column B to convert data that looks like the data in column A, into column B? Column A's current format is General. The resulting format of column B can be Date, but does not have to be. If the Length of column A were consistent, I would not have a problem coming up with the formula, but because the lengths vary, and in different places, I'm struggling with coming up with a solution.

AB
1957-1-21957-01-02
1957-6-211957-06-21
1957-12-11957-12-01
1957-11-111957-11-11

<tbody>
</tbody>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Assuming you want text values returned, this works for me...

=TEXT(A1,"yyyy-mm-dd")

Otherwise use Dave's suggestion in Message #3 .
 
Last edited:
Upvote 0
Wow, all three of these solutions work! I can't believe there were this many ways to go about it and I didn't think of any of them. Thank you @RickRothstein, @DavePatton and @SpillerBD!
 
Last edited:
Upvote 0
and all better than the mega-formula that parses the text.
Not recommended, but is...
Code:
=DATE(LEFT(A1,FIND("-",A1)-1),MID(A1,FIND("-",A1)+1,FIND("-",A1,FIND("-",A1)+1)-FIND("-",A1)-1),RIGHT(A1,LEN(A1)-FIND("-",A1,FIND("-",A1)+1)))
:eek:
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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