changing format date in excel using formula - excel-formula

I have a excel with date format as " Feb 1 2020 1:00AM "
I am trying to convert this format to " 08-10-2019 10:27:50 "
I have tried using text formula but date format remains same its not changing.

Feb 1 2020 1:00AM is not a date format that Excel recognizes and as such it is a text string and not a number that can be reformatted.
One needs to parse the string to something that Excel will recognize: 1 Feb 2020 1:00 AM
This formula parses the string and turns it into a number that can be formatted as desired:
=--REPLACE(TEXTJOIN(" ",,FILTERXML("<a><b>"&SUBSTITUTE(A1," ","</b><b>")&"</b></a>","//b["&{2,1,3,4}&"]")),LEN(A1)-1,0," ")
Then format the date either: mm-dd-yyyy hh:mm:ss or dd-mm-yyyy hh:mm:ss depending on locale.

Related

How to change numbers to date in a composite formula in excel

I wanted the output Today's date: 04 January 2021 and used the formula ="Today's date: "& TODAY() but the output was Today's date: 44200. How do I change this to date format?
I tried the following:
Change the cell format using Home>> Number>> General to Date
Using the text to columns option Data>> Data tools>> Text to columns
Using the format cells and setting the format type as "dd-mm-yyyy". I know that gives output as something like 04-01-2021 but at least that would be an improvement.
with TEXT:
="Today's date: "& TEXT(TODAY(),"DD MMMM YYYY")

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)

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)

Convert cell value to DateTime

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

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