When I paste a time with milliseconds like this 21:34:58.342 into excel, it does not get converted into time format and is stored as text instead. I've tried converting it manually by means of =--TEXT(A1;"hh:mm:ss.000") but it produces #VALUE! error.
How do I convert time with milliseconds text to time format?
Update
If I paste 21:34:58 the value is converted into Time correctly. If I apply h:mm:ss.000 format to the resulting cell the value is displayed as 21:34:58.000. But if I edit the cell and add a millisecond to the value 21:34:58.001 it becomes Text.
Most likely, your system (see Windows Regional Settings) decimal separator is not a dot. You need to use your system decimal separator when you enter the millisecond value. Most likely, that is a comma. You may need to use your system decimal separator in your format string also.
Related
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
I was using a formula for converting hours greater than 24 hours but that formula gives an error when it comes to thousands of hours.
I want to convert 283398:02:08 into decimal, but every time I try it gives an error.
In Excel, the largest amount of time that can be entered manually is 9999:59:59.
If you are entering time manually and it is greater than that, it will be converted to a text string.
To convert the text string to decimal hours, you need to use text manipulation functions to split the string (by the colon) and multiply the hours*1, minutes*1/60, seconds *1/60/60
So, if you have Excel 2013+ with the FILTERXML function, you can use:
=SUMPRODUCT(FILTERXML("<t><s>" & SUBSTITUTE(A1,":","</s><s>")&"</s></t>","//s"),{1;0.0166666667;0.00027777778})
If the time is a number, and not a string, then just:
=A1*24
and format as a decimal number
I import data from web external query in excel in which zero value represented as dash, to further calculation on this I need to consider this dash as zero
for that I have macro to convert dash to zero but, data gets refreshed every 5 min. so I need to run that replacement macro every 5 min.
instead of this I want to do is,apply format cell in which dash will be considered as zero and I will import data by selecting preserve format, so no need to run replacement macro every 5 min.
So pls let me know custom format cell in which positive value ll be consider as positive,negative as negative but dashes as zero
thank you.
In your custom format cell use the following format: #;-#;"-";#
It decomposes as positive numbers; negatives; nul value; any text.
I Commonly use: #,00;-#,00;"-";# to set get 2 digit precision.
Access format cells with right click > Format Cells... > tab Number > Category custom
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.
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.