PDA

View Full Version : Extract Date and time from the Text Column



zorro
08-17-2016, 07:33 PM
This is how my text looks like.
Unable to identify the source system. The user account seems to be a service account for Rancid which is a config backup software. Tausif.Shaikh Aug 8, 2016, 3:12:50 PM
I need to extract just the date and time from this text, date and time is always at the end.

Rick Rothstein
08-17-2016, 09:04 PM
Give this formula a try (Custom Format the cell to display the date-time format you want)...

=0+SUBSTITUTE(TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",300)),1500),1500)),",","",2)

zorro
08-18-2016, 03:15 PM
Thanks, not sure if it is running or not, gives #VALUE!

Admin
08-18-2016, 03:55 PM
Have you adjusted the cell A1 in the formula with the actual cell ?

Excel Fox
08-18-2016, 03:56 PM
Looks fine in the attachment.

zorro
08-18-2016, 07:10 PM
Yes did adjusted the right cell, anyways the sheet that you have sent works perfectly fine, so copied over the data onto it and moved the results back to the original sheet, thanks for all your help.

zorro
08-18-2016, 07:20 PM
Just realized that date and time is not always at the end, it's anywhere in the column, please help to extract it from the below text.

Current count 119. Keeping under monitoring. Admin.Tausif Aug 9, 2016, 6:48:14 PM "This offense was closed with reason: Activity Stopped. Notes: Activity has stopped now and no more failed login attempts were observed

Rick Rothstein
08-18-2016, 07:39 PM
Just realized that date and time is not always at the end...
Well, that changes everything. Assuming your time values always have either an AM or PM designation, give this formula a try...

=IFERROR(0+SUBSTITUTE(TRIM(LEFT(RIGHT(SUBSTITUTE(L EFT(A1,IFERROR(FIND(" PM",A1),FIND(" AM",A1)))," ",REPT(" ",300)),1500),1500)),",","",2),"")

zorro
08-18-2016, 07:52 PM
It works, just that it is picking the time only in AM, even if it is PM

Rick Rothstein
08-18-2016, 08:09 PM
It works, just that it is picking the time only in AM, even if it is PM
Sorry, I forgot to add 2 in order to retain the AM/PM designation. Here is the revised formula....

=IFERROR(0+SUBSTITUTE(TRIM(LEFT(RIGHT(SUBSTITUTE(L EFT(A1,IFERROR(FIND(" PM",A1)+2,FIND(" AM",A1)+2))," ",REPT(" ",300)),1500),1500)),",","",2),"")

zorro
08-19-2016, 12:51 PM
Perfect, thanks for all your help !!!

snb
08-22-2016, 02:48 PM
Or simply


=MID(A1;FIND(":";A1)-15;25)

jolivanes
09-01-2016, 10:31 AM
I don't know if you tried snb's formula but if you found that it does not work it is because you need to change the semicolon (;) to a comma(,).
You might also take his counting with a grain of salt. 15 Should be 14 and 25 should be 23.
No offence snb. I know you want people to think for themselves.

rollis13
09-02-2016, 03:37 AM
@jolivanes, have you tested with:

Tausif.Shaikh Aug 8, 2016, 11:12:50 PM
or
Tausif.Shaikh Aug 18, 2016, 3:12:50 PM

jolivanes
09-02-2016, 04:47 AM
Indeed. I stand corrected.
I guess instead we could use Trim
My apologies snb.

snb
09-02-2016, 01:00 PM
@joli

I don't accept, because you shouldn't have apologized in the first place. I always appreciate your contributions very much. %D

jolivanes
09-02-2016, 07:32 PM
ok, thanks for the kind words and we'll leave it at that.
Keep on "duimen voor Max Verstappen"

snb
09-02-2016, 09:16 PM
Now I don't anymore.... ;)
You remember the agreement of Paris to reduce....

Admin
09-04-2016, 03:06 PM
Keep on "duimen voor Max Verstappen"

For Kimi :)

jolivanes
09-17-2016, 10:16 AM
@Admin
Kimi is doing better in Singapore.
Could not fing anything for him though.