Parse text and reformat output

Alphacsulb

Active Member
Joined
Mar 20, 2008
Messages
414
In cell C1 I have the follow string:
O:\Data\Search Requests\2019\20190107 - Christine_Smith


I'm looking for a way to get the date 20190107 in cell A1.

Cell A1 is date formatted so it needs to recognize it as a date, not sure if the only way to do that is 01/07/2019.

Maybe a search starting at the right getting everything from the first number to the first \, and then output it as 01/07/2019?

:eeek:
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Maybe

=DATE(MID(C1,FIND(" -",C1)-8,4),MID(C1,FIND(" -",C1)-2,2),MID(C1,FIND(" -",C1)-4,2))
 
Upvote 0
Another option:

=DATEVALUE(REPLACE(REPLACE(MID(C1,FIND(" -",C1)-8,8),7,0,"/"),5,0,"/"))

Like gaz_chops, it relies on finding " -" to locate the date part. If that can occur elsewhere, we may need to change the formula.
 
Upvote 0
Another option:

=DATEVALUE(REPLACE(REPLACE(MID(C1,FIND(" -",C1)-8,8),7,0,"/"),5,0,"/"))

Like gaz_chops, it relies on finding " -" to locate the date part. If that can occur elsewhere, we may need to change the formula.

This appears to work!
 
Upvote 0
another way :)

Video-2019-01-31-185201a.gif
 
Upvote 0
As i use the "proper" date format as used in England :-P

=DATE(MID(C1,FIND(" -",C1)-8,4),MID(C1,FIND(" -",C1)-4,2),MID(C1,FIND(" -",C1)-2,2))
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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