Date / Time Extraction

robb12

New Member
Joined
Jun 6, 2016
Messages
4
Hi, and thanks for all help in advance.

I down load date and time information and it comes in a relatively difficult format.

2017-11-17T09:18:00

Could you please show me some good formulas to extract specific parts - ideally so I can get a separate date and separate time column?

Cheers
Cam
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Is the format always exactly the same? It's easier to write a formula if it is. So the following formulae rely on a couple of rules:

1. The "T" always separates the date and time
2. Both the date and time ALWAYS have leading zeros (e.g. 2017-02-05T04:00:00)

Formula to extract date from cell A1: =DATE(LEFT(A1,4),MID(A1,6,2),MID(A1,9,2))
Formula to extract time from cell A1: =TIME(MID(A1,FIND("T",A1,1)+1,2),MID(A1,FIND("T",A1,1)+4,2),MID(A1,FIND("T",A1,1)+7,2))


Hope this helps.
 
Upvote 0
1. The "T" always separates the date and time
2. Both the date and time ALWAYS have leading zeros (e.g. 2017-02-05T04:00:00)
If your assumptions are correct, these simple formulas will work..

For the date: =0+LEFT(A1,10)

For the time: =0+RIGHT(A1,8)

These formulas will return the date/time serial numbers so the individual cell will have to be formatted with the desired date and time formats.
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

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