Convert cell value to DateTime - excel

I have a row of cells in Excel filled with datetimes in the following messy format: July 13, 2016 at 12:10AM. I want to convert this to 2016/07/13 12:10 ('yyyy/mm/dd hh:mm' in the 24h format). Can I do this using a formula or should I write a vba code for this?

Two issues:
First you must remove the at
Second you need a space between the time and the AM or PM
The follow formula will turn it into a date/time:
=--SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"at",""),"AM"," AM"),"PM"," PM")
Then you can format the cell with the custom format:
yyyy/mm/dd hh:mm

Related

convert from text to date format in excel

I have 2 text as below want to convert to date in excel
2/10/2001 4:00:00 AM
2/10/2001 12:30:00 PM
I tried =DATEVALUE() and TEXT(A1, "mm/dd/yyyy hh:mm") in excel which returns me error
I also tried to calculate these 2 dates which also return me error
Try below formula
=TEXT(--LEFT(A1,SEARCH(" ",A1)-1)+(--MID(A1,SEARCH(" ",A1)+1,100)),"mm/dd/yyyy hh:mm:ss AM/PM")
This simple formula should also work- format the resulting cell as mm/dd/e hh:mm:ss AM/PM
=TRIM(DATEVALUE(A1))+TRIM(TIMEVALUE(A1))
FILTERXML() will also work.
=TEXT(SUM(FILTERXML("<t><s>"&SUBSTITUTE(TRIM(A1)," ","</s><s>")&"</s></t>","//s[position()<3]")),"mm/dd/e hh:mm:ss AM/PM")
I'm not sure I understand the question. When you enter those values into a spreadsheet, Excel understands them as date/time values. No conversion is necessary. You can perform date/time arithmetic on them as is.
Cell A1 & B1 show the values I copied from your question and pasted into the worksheet. C1 shows the time interval in hours.

parse difficult date/time string in excel table formula

I have date/time text values in a column of an excel table. Ignore the quotation marks...
"October 1, 2020 6:00 pm"
"October 2, 2020 6:00 am"
Excel does not parse this automatically as a date/time.
What formula will allow me to parse this to a date/time excel represents as a true date/time
Cheers
If above information is in string format and consistent as depicted then below formula can be used.
For date:
=DATEVALUE(LEFT(A1,FIND(":",A1,1)-3))
For time:
=TIMEVALUE(MID(A1,FIND(":",A1,1)-2,99))
If data is in actual date time then following can be used.
For date:
=INT(A1)
Format cell in date format.
For time:
=A1-INT(A1)
Format cell in time format.
Edit:
You can try below formula which is rather unwieldy. It should work irrespective of locale.
=DATE(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",99)),2*99,99))+0,LOOKUP(99,SEARCH(TEXT(1+ROW($A$1:$A$12)*29,"mmmm"),A1,1),ROW($A$1:$A$12)),TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1," ",REPT(" ",99)),",",REPT(" ",99)),99,99))+0)

Converting MM:DD:YYYY hh:mm:ss to DD:MM:YYYY hh:mm:ss in excel

I'm trying to convert the timestamp data in Microsoft excel where the timestamp is coming asMM:DD:YYYY hh:mm:ss (12/25/2016 12:00:55 AM).this Formet doesnt support in excel and i wanted to change it to DD:MM:YYYY hh:mm:ss (25/12/2016 12:00:55 AM)
i have seached so many times but all i get is DD:MM:YYYY to MM:DD:YYYY which is not the case.
Either add a column with =MID(B2,4,3) & LEFT(B2,2) & RIGHT(B2,17) where B2 is replaced with your date value cell reference (The formula only works if all dates are in that 22 character format you used as an example).
or
write a macro to amend the values in that column.

excel date format MMYYYY

i have fiscal date MMYYYY that needs to be converted to a date mm/dd/yyyy. Since I don't have date in original data I can use 01 for entire column. I have tried text to columns and have been unsuccessful.
It can also me converted as mm-dd-yyyy or in any order as long as sepearated by - or a /
You have to parse the text. If you have your date as Text formatted 'MMYYYY' in cell A1:
=DATE(RIGHT(A1,4),LEFT(A1,2),1)

Excel 2013 date format conversion. 30 Jan, 15 18:02:05 to 30.01.2015

In MS Excel 2013 I import a CSV file, no matter if I format it using the delimined or any other option the results are the same. My date in Excel looks like: 30 Jan, 15 18:02:05 in a single cell. All I need is to convert it to a date format 30.01.2015 for example. I have a column of these and need to convert the values at once. (I tried TEXT, DATE, MID, DATEVALUE, MONTH, DATEVALUE...) but none of them are able to convert the date format. Also it does not matter if I convert it with format cells...to date it always displays the same i.e. 30 Jan, 15 18:02:05
Not sure what I am doing wrong. Getting a bit frustrating, thanks for any advice. Most of the above give a #VALUE error.
With data in A1 in B1 enter:
=DATEVALUE(LEFT(A1,FIND(" ",A1)-1) & "-" & MID(A1,FIND(" ",A1)+1,3) & "-20" & MID(A1,FIND(",",A1)+2,2))
and format B1 as dd.mm.yyyy for example:

Resources