Convert hh:mm:ss to decimal days - excel-formula

I am having the worst time trying to find what seems to be a simple formula. I want to convert hh:mm:ss into days with a decimal rounded to tenths of a day.
36:00:00 result = 1.5 days
49:32:28 result = 2.1 days
Every format I try turns into some odd value.

You could use VALUE. And if you want to ignore blanks (which would result in 0), then wrap it into an IF like this:
=IF(A1="", "", VALUE(A1))

Related

Converting Non-Time String into HH:MM

I have a Cell range that contains data in the following format:
1d 12h 37m
All Data is in this format but ranges from single to double digit values.
I need to try to convert this data as an ultimate goal into purely hh:mm
I am struggling with the conversion of this. The main issue arises when the number of digits varying between double and single digits.
I have the formula to extrapolate purely the numbers and remove the letters from this:
=SUM(ROUND(MOD(SMALL(IFERROR(ROW(OFFSET(A$1,,,LEN(A11)))+MID(A11,1+LEN(A11)-ROW(OFFSET(A$1,,,LEN(A11))),1)%, LEN(A11)+1), ROW(OFFSET(A$1,,,SUM(N(ISNUMBER(0+MID(A11,ROW(OFFSET(A$1,,,LEN(A11))),1))))))),1)*100,0)*(10^(ROW(OFFSET(A$1,,,SUM(N(ISNUMBER(0+MID(A11,ROW(OFFSET(A$1,,,LEN(A11))),1))))))-1)))&""
Ideally this needs to all be done as a formula but a VBA script is okay.
Any ideas?
You can use this formula to change to date/time:
=IFERROR(LEFT(A1,FIND("d",A1)-1),0)+TRIM(SUBSTITUTE(SUBSTITUTE(MID(A1,IFERROR(FIND("d",A1)+1,1),LEN(A1)),"h ",":"),"m",""))
Then either format it [hh]:mm which will return 36:37 or hh:mm which will return 12:37
=TEXT(((LEFT(A2,FIND("d",A2)-1))+((TRIM(MID(A2,FIND("d",A2)+1,FIND("h",A2)-FIND("d",A2)-1)))+((TRIM(MID(A2,FIND("h",A2)+1,FIND("m",A2)-FIND("h",A2)-1)))/60))/24),"[h]:mm")
This formula assumes a couple things:
"d", "h", "m" will always be present
You need Days converted to Hours
Explanation:
Days:
=(LEFT(A2,FIND("d",A2)-1))
Hours:
=(TRIM(MID(A2,FIND("d",A2)+1,FIND("h",A2)-FIND("d",A2)-1)))
Minutes:
=(TRIM(MID(A2,FIND("h",A2)+1,FIND("m",A2)-FIND("h",A2)-1)))
Combining:
=TEXT((<days>+(<hours>+(<minutes>/60))/24),"[h]:mm")
If you want it without Days converted to Hours, change "[h]:mm" to "hh:mm".

Converting large time format to decimal in excel

I'm trying to convert a large time value in excel to a decimal number for hours.
I currently have a column adding up "Ready time" for a call centre which is 3545:20:02 as a SUM. I now want that to show me the same hours in a decimal format e.g. 3545.333 as it's used in another calculation.
For reference, when I convert the above time to a General excel value, it is 147.7222454.
The formula I've been using is: =IFERROR((DAY(M54)*24) + HOUR(M54) + (MINUTE(M54)/60),0) and has been working fine for smaller time values.
Thanks in advance!
Excel counts in days (1 day = 1) so for hours you just multiply by 24, i.e.
=M54*24
format result cell as number with required number of decimals
[the reason your current formula fails is because of DAY function - DAY is day of the month so it fails for you when the time value is >= 32*24 = 768 hours]

How to convert DD:HH:MM to HH:MM in Excel

I am facing a problem with excel.How can I convert DD:HH:MM to HH:MM in excel?
Here is an exmaple showcasing what I need.
1:02:49(1day, 2hours, 49 mins) should come as 26:49(26 hours, 49 min)
I'm guessing that your 1:02:49 cell is formatted as text; otherwise, you could just change the cell format from DD:HH:MM to HH:MM.
I've opted to output as text, but could change it to an actual Time value if needbe.
Yes, the formula is a bit long but it can cope with any number of digits between each :. So, for example, 100:3:4 (100 days, 3 hours, 4 minutes) would correctly evaluate to 2403:04
=24*LEFT(A1,FIND(":",A1)-1)+MID(A1,FIND(":",A1)+1,LEN(A1)-2-LEN(RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1,":","#",2))))-LEN(LEFT(A1,FIND(":",A1)-1)))&":"&TEXT(RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1,":","#",2))),"00")

How to convert long minutes to hours in excel

I need a formula in excel to convert minutes to hours. Until now came the following formula:
=A1/1440
So, 180minutes its converted to 03:00, when formatted as hh:mm
But, i need also to convert long minutes, like 1600. In this case, the formula converts to 02:40, when it should show 26:40.
Any ideas?
You can try
=INT(A1/60)&":" &MOD(A1,60)
and =TEXT(FLOOR(A1/60,1),"00")&":"&TEXT(MOD(A1,60),"00") for Format hh:mm
Use exactly the same formula you are using now, but change the display format to:
[h]:mm:ss
That will display in the format you want AND allow you to perform operations on the values.
( With format showing in the top of the time columns)
[h]:mm:ss hh:mm:ss Equal?
=1600/1440 =1600/1440 =G23=F23
=F23+1600/1440 =G23+1600/1440 =G24=F24
Gives
[h]:mm:ss hh:mm:ss Equal?
26:40:00 2:40:00 TRUE
53:20:00 5:20:00 TRUE

Excel Convert text to timestamp

I have the following text timestamp in cell A1. 22-OCT-13 03.40.00.000000000 AM. In B1 I have the following formula: =TIME(HOUR(MID(A1,11,2)),MIN(MID(A1,14,2)),SECOND(MID(A1,17,2))).
It yields 12:40 AM. The hour function returns zero, but the minute function works fine. I can't figure out what's up with it.
MIN is the 'minimum' formula that returns the smallest value out of a list of values, not the MINUTE formula.
I think you are not familiar with TIME(), HOUR() or MINUTE().
TIME() takes 'normal' values and converts them into a time value. If you have TIME(H, M, S), H is the number of hours (not a timestamp), M is the number of minutes (not a timestamp either) and S is the number of seconds (yet again, not a timestamp).
HOUR() takes a time value and extracts the hour from it.
MINUTE() and SECOND() are similar to HOUR(). What you probably meant to have is:
=TIME(MID(A1,11,2),MID(A1,14,2),MID(A1,17,2))
When you use MID() you are getting a number, not a timestamp. So, HOUR takes that number, interprets it as a timestamp and return the hour. In your example, the first MID returns 03. In excel, if you convert that to a timestamp, you get 03/01/1900 00:00 (in dd/mm/yyyy hh:mm format) and the hour is thus 0.
EDIT:
By the way, you could use this formula if you want to keep the date and time (not forgetting the AM/PM at the end:
=SUBSTITUTE(SUBSTITUTE(A1,".",":"),":",".",3)*1
The original date/time is almost one that can be understood by Excel. Replace all . with : and then replace the 3rd (last) : by . and multiply by 1 to tell Excel to convert that to a number. Just format the result as time and that should do it.

Resources