Conver scientific format timestamp to date excel - excel

I have difficulty in converting the timestamp recorded in excel. The format is in scientific, I would like to convert to date format in excel.
Scientific = 2.02207E+13 (in number format 20220715030838)
I expect the result will be 15-Jul-2022 03:08
Thanks

Use below formula to convert date/time value.
=--TEXTJOIN("/",TRUE,MID(A1&"",{1,5,7},{4,2,2}))+(--TEXTJOIN(":",TRUE,MID(A1&"",{9,11,13},{2,2,2})))
Then use cell format to display results as desired format. Or can use TEXT() function like-
=TEXT(--TEXTJOIN("/",TRUE,MID(A1&"",{1,5,7},{4,2,2}))+(--TEXTJOIN(":",TRUE,MID(A1&"",{9,11,13},{2,2,2}))),"dd-mmm-yyyy hh:mm")

My answer is here, make sure that singe digit date should come with 0 as highlighted in the pic. Either you can customise the format or use Text function.
If you want seconds as well then use Right(A2,2) function in Second argument in the Time function. Hope it clears.
=TEXT(INT(DATE(LEFT(A2,4),MID(A2,5,2),MID(A2,7,2)))+TIME(MID(A2,9,2),MID(A2,11,2),),"dd-mmm-yyy hh:mm")
=INT(DATE(LEFT(A2,4),MID(A2,5,2),MID(A2,7,2)))+TIME(MID(A2,9,2),MID(A2,11,2),) #customise the format.

Related

What is the shortest formula in excel to covert text date format e.g. 17 Jan, 2023 into regular date format like 1/17/2023?

I have sales data where transaction date is mentioned as text like 17 Jan,2023. I want to extract month name using TEXT(A1,"MMM") or MONTH(A1) function however these two functions does not work with text date format.
I have tried multiple formulas to convert text date format to normal date format but I didn't get the right answer or the optimized small function or formula.
Later, I tried the following formula but it is too long and complex to use.
=DATE(RIGHT(A1,4),MATCH(MID(A1,1,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0)-1+1,DAY(LEFT(A1,FIND(",",A1)-1)))
My question is that if anybody knows are shortest way to do the same?
In an English-language locale, the VALUE() function will recognise 17 Jan 2023 as a valid date (although you will have to render the date format manually), so the SUBSTITUTE() function can be used to remove the , that appear in your text, and then nesting this in the VALUE() function should return an Excel-recognised date, i.e.
=VALUE(SUBSTITUTE(A1,","," "))

Operations time durations in Excel

I am working on a datasets in Excel in which I have a column named Duration containing values such as 11:01, 01:39:13 etc. The format here is either hh:mm:ss or mm:ss. How can I do operations such as addition & subtraction on such values?
The file is of XLSX format & I am working on the latest version of Office.
Most likely your "times" are actually text that look like times. They will need to be converted to actual times to be summed.
The issue is that if one does a straight conversion on 11:01 Excel will assume hh:mm not mm:ss
So we need to add some parsing to get the correct time format then sum the results:
=SUMPRODUCT(--RIGHT("00:"&B2:B4,8))

How to convert UTC to datetime in Excel

I am trying to convert UTC to datetime in EXCEL SHEET.
Below is the input
2020-04-10T22:15:40.5577209Z
So far to convert I have put below formula
=(SUBSTITUTE(A2,"T"," "))
This gives me output as
2020-04-10 22:15:40.5577209Z
Now I need to trim the .5577209Z part.
Final output should be
2020-04-10 22:15:40
Can someone help me with this?
The result you want would be produced with a formula like this one. (The original string is in A2)
=DATEVALUE(LEFT((SUBSTITUTE(A2,"T"," ")),18))+ TIMEVALUE(LEFT((SUBSTITUTE(A2,"T"," ")),18))
The formula takes the first 18 characters of the received string. If you are sure that there are no letters in the next couple of digits you could extend this to 20 or more and get a better rounding of the seconds.
Another approach would be to work around the offending "T".
=DATEVALUE(LEFT(A2,10))+TIMEVALUE(MID(A2,12,8))
Again the final 8 in the formula could be extended for better rounding of seconds. Or, if it's always a "Z" it could simply be removed like you already removed the "T".
Either solution gives you a true Date/Time value - a 5-digit number with lots of decimals. This you convert into a legible date by means of the cell format. Apply a custom format like yyyy-mm-dd hh:mm:ss

Excel : Text to date conversion with milliseconds

I am trying to convert a datetime string such as 2015-11-01-02.02.38.444000 to Datetime format in Excel. I have tried solutions provided in previous questions, but this particular format was not covered. I am looking to have both date and time in the same cell. Please assist.
It depends how consistent the strings are, but for this particular one you could try
=VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-"," ",3),".",":",1),".",":",1))
then use custom formatting to show it as a datetime value with milliseconds
dd/mm/yyyy hh:mm:ss.000
(you may have to change this for your locale).
BTW to make the TIMEVALUE formula in your comment work you would have to change the first two decimal points to colons.

Excel dates - converting different date formats into a single format

Have a large raw data dump and I am trying to format the dates into a consistent format.
As you can see from the screenshot, there are two main formats, one custom mm-dd-yyyy hh:mm AM/PM and mm/dd/yyyy hh:mm:ss. One is stored as general, while the other as a custom value.
I've tried to =left(A2,8), converting via text() and using text to columns, but can't bring the values to a consistent value.
It appears that your Windows regional settings for Short Date are DMY or similar. It is likely your data dump is in MDY format. That is why A2 and A4 are being converted to "real dates" (although incorrectly), and A3 is not since Excel does not know what do with month = 13. You will note that A2 is 1-Dec-2015 and I suspect that in the original data it is 12-Jan-2015.
EDIT: To expand a bit on the explanation. When something that looks like a date or time is entered into an Excel cell, Excel tries to change the result to a date, parsing the input according to the Windows Regional Short Date format. This sometimes has an undesireable outcome. For example, if your Windows Format is MDY but the date is input as DMY, input with days <=12 will be converted incorrectly, and input with days > 12 will be retained as text. This behavior cannot be "turned off" and causes many complaints from those who want to enter data that looks like a date, but is not. (For example, entering an odds ratio as 1-10 or 12:3 will get converted to a date or a time)
Several options
Change the output of the data so as to have the dates in DMY format.
Instead of OPENing the data file, do a Text Import. In later versions of Excel, you will find this on the Data Ribbon ► Get External Data ► From Text. This will open the Text import wizard and allow you to specify the MDY format of the incoming data before Excel transforms it.
After you have done one of the above, the result will be a "real" Excel date or date/time and you can format it how you like.
Write a IF() where if column B specifies "Custom" change format to standard.
For AM, just remove it(replace AM with nothing). For PM add 12 to the hours and replace PM with nothing.
For custom Replace - with / and append :00 to add the seconds to the custom ones too.

Resources