Extract Date and Time

kmonkmol

Board Regular
Joined
Mar 13, 2014
Messages
50
Hello
I have a Sales Data Sheet, I need Extract my date and time in separate column from a text range. i attached my file please reply me.

Here is the link
 
Another option. You will probably need to format cells as Date and Time.
Book2
ABCDEFGHIJKL
1Order IDDateOuletUserTerminalSKUProductQuantityUnit PriceTotalEDateETime
23125563/31/2023 0:02Mobile Sales 1MS1JMEIT1515035424PRODUCT-1150503/31/202312:02 AM
33125573/31/2023 0:04Mobile Sales 1MS1JMEIT151507963PRODUCT-225103/31/202312:04 AM
43125583/31/2023 0:05Mobile Sales 1MS1JMEIT151508985PRODUCT-3125253/31/202312:05 AM
53125593/31/2023 0:08Mobile Sales 1MS1JMEIT151507963PRODUCT-21553/31/202312:08 AM
63125603/31/2023 0:09Mobile Sales 1MS1JMEIT151507963PRODUCT-21553/31/202312:09 AM
73125613/31/2023 0:12Mobile Sales 1MS1JMEIT151507963PRODUCT-225103/31/202312:12 AM
Sheet1
Cell Formulas
RangeFormula
K2:K7K2=INT(B2)
L2:L7L2=B2-INT(B2)
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Please confirm your regional settings for date and time.

Here is a universal excel version:
mr excel questions 21.xlsm
ABCDEFGHIJKL
16312,5703/31/2023 12:44:39 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:44:39 PM
17312,5713/31/2023 12:45:34 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:45:34 PM
18312,5723/31/2023 12:46:35 AMMobile Sales 1MS1JMEIT151507671PRODUCT-11230602023-03-3112:46:35 PM
19312,5733/31/2023 12:47:02 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:47:02 PM
kmonkmol
Cell Formulas
RangeFormula
K16:K19K16=DATE(RIGHT(LEFT(B16,FIND(" ",B16)-1),4),LEFT(B16,FIND("/",B16)-1),MID(B16,FIND("/",B16)+1,FIND("/",B16,FIND("/",B16)+1)-(FIND("/",B16)+1)))
L16:L19L16=TIME(MID(B16,FIND(" ",B16)+1,FIND(":",B16)-(FIND(" ",B16)+1)),MID(B16,FIND(":",B16)+1,FIND(":",B16,FIND(":",B16)+1)-(FIND(":",B16)+1)),LEFT(RIGHT(B16,5),2))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:A1317Expression=MOD(A1,1)=0textNO
H1:H1317Expression=MOD(A1,1)=0textNO
I1:I1317Expression=MOD(A1,1)=0textNO
J1:J1317Expression=MOD(A1,1)=0textNO
 
Upvote 0
You have received many different approaches that will work, most of them in any version of excel.
You will need to post a sample of your worksheet.
If you are editing the formulas then you are probably editing it incorrectly.
 
Upvote 0
Please confirm your regional settings for date and time.

Here is a universal excel version:
mr excel questions 21.xlsm
ABCDEFGHIJKL
16312,5703/31/2023 12:44:39 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:44:39 PM
17312,5713/31/2023 12:45:34 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:45:34 PM
18312,5723/31/2023 12:46:35 AMMobile Sales 1MS1JMEIT151507671PRODUCT-11230602023-03-3112:46:35 PM
19312,5733/31/2023 12:47:02 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:47:02 PM
kmonkmol
Cell Formulas
RangeFormula
K16:K19K16=DATE(RIGHT(LEFT(B16,FIND(" ",B16)-1),4),LEFT(B16,FIND("/",B16)-1),MID(B16,FIND("/",B16)+1,FIND("/",B16,FIND("/",B16)+1)-(FIND("/",B16)+1)))
L16:L19L16=TIME(MID(B16,FIND(" ",B16)+1,FIND(":",B16)-(FIND(" ",B16)+1)),MID(B16,FIND(":",B16)+1,FIND(":",B16,FIND(":",B16)+1)-(FIND(":",B16)+1)),LEFT(RIGHT(B16,5),2))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:A1317Expression=MOD(A1,1)=0textNO
H1:H1317Expression=MOD(A1,1)=0textNO
I1:I1317Expression=MOD(A1,1)=0textNO
J1:J1317Expression=MOD(A1,1)=0textNO
Dear @awoohaw
I truly appreciate your thorough and insightful response - it was a great answer to my question.
 
Upvote 0
@kmonkmol , My pleasure. I am happy you found a solution.
As you can see when you have dates embedded in text or just as text they are super hard to work with. If at all possible you can avoid that in other workbooks you will save yourself a lot of headaches!

Best wishes!
 
Upvote 0
Please confirm your regional settings for date and time.

Here is a universal excel version:
mr excel questions 21.xlsm
ABCDEFGHIJKL
16312,5703/31/2023 12:44:39 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:44:39 PM
17312,5713/31/2023 12:45:34 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:45:34 PM
18312,5723/31/2023 12:46:35 AMMobile Sales 1MS1JMEIT151507671PRODUCT-11230602023-03-3112:46:35 PM
19312,5733/31/2023 12:47:02 AMMobile Sales 1MS1JMEIT151507963PRODUCT-4125252023-03-3112:47:02 PM
kmonkmol
Cell Formulas
RangeFormula
K16:K19K16=DATE(RIGHT(LEFT(B16,FIND(" ",B16)-1),4),LEFT(B16,FIND("/",B16)-1),MID(B16,FIND("/",B16)+1,FIND("/",B16,FIND("/",B16)+1)-(FIND("/",B16)+1)))
L16:L19L16=TIME(MID(B16,FIND(" ",B16)+1,FIND(":",B16)-(FIND(" ",B16)+1)),MID(B16,FIND(":",B16)+1,FIND(":",B16,FIND(":",B16)+1)-(FIND(":",B16)+1)),LEFT(RIGHT(B16,5),2))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:A1317Expression=MOD(A1,1)=0textNO
H1:H1317Expression=MOD(A1,1)=0textNO
I1:I1317Expression=MOD(A1,1)=0textNO
J1:J1317Expression=MOD(A1,1)=0textNO
Why i am getting instead of "AM" getting "PM"
 
Upvote 0
I'm not sure, what ROW is this happening in? Check to ensure the formulas reference the same ROW.
If on ROW 16, then all the cell references should say B16, not B3 or anything else.
 
Upvote 0
I'm not sure, what ROW is this happening in? Check to ensure the formulas reference the same ROW.
If on ROW 16, then all the cell references should say B16, not B3 or anything else.
See your example in Post #13 there is also "PM" instead of "AM"
 
Upvote 0
here is a corrected version:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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