Excel 2007 - Time exceeding 24 hours where [h]:mm doesn't work - excel

I'm building a spreadsheet to calculate aircraft flying hours which will exceed 24. I am aware of the [h]:mm format to force Excel to not use units of days.
I want to set a threshold number of hours which I will subtract a running total from. However with the [h]:mm format set if I enter 1 in the cell, for 1:00, instead it interprets it as 24:00 - one day.
How can I avoid this, so that I can do simple arithmetic with hours and minutes exceeding a 24 hour period?

Type 1:0 or even just 1: instead of just 1
If you type 1 excel interprets this as the value 1, which is date serial value to 1 day (actually 1/1/1900)
If you type something that looks like a time (eg contains a :) then excel interprets it as a string representation of a time and converts it to the corresponding serial value (0.041666667 or 1/24) and applies the format so it displays as 1:00

Related

Extract the hour from the h" hour(s) and "m" minute(s)" in excel

I have the list of data that showing the Hours and the Minutes that I extract from the system. I need to be extract the hours.
As example below, column B first row, the Hours would be 64 and the minutes would be 46.
But when I used the formula =Hour , its turn up the different value since its actually decimal number.
Cannot use left() , it will give the actual decimal number.
Updated:
We tried the #harun24HR 's but cannot readable the value.
But if you noticed, if i copy and paste the value is different. thats why the search not applicable.
4th Update:
To Solar Mike, I have tried the formula given from the thread the i think the value not readable
It's a time value which Excel stores as calculated value based on 24 hours = 1.
To retrieve the hours only you can use:
=INT(A2*24)
To retrieve the minutes only you can use:
=(A1-(INT(A1*24)/24))*24*60
Your time value is already a number in time format so you just need it to change it to decimal system. Dates and time values are numbers. Even if you see it as 30/09/2019 or 12:00:00, actually, for Excel, both cases are numbers.
First date Excel can recognize properly is 01/01/1900 which integer numeric value is 1. Number 2 would be 02/01/1900 and so on. Actually, today is 44659.
Now, about your data, you posted this screenshoot:
So the value is numeric, not text/string. In Excel, what you see is not always what you have. Probably that column has been formatted using custom mask. My fake data is like this:
The numeric value is 02/01/1900 16:46:36 (or 02/01/1900 4:46:36 PM it depends on your regional settings) but I've applied a custom format like this:
[hh]" hours" mm " minutes"
So what I have is a number but what I see is a text!
We have to work with the number (to be honest, ist's easier to work with numbers), so to extract the total hours, minutes and seconds.
Formula in B1: =INT(A1*24) total hours
Formula in C1: =INT(A1*24*60-B1*60) total minutes
Formula in D1: =A1*24*60*60-B1*60*60-C1*60 total seconds
This should guide you on whatever are you trying to achieve.
From your current sample data you try-
For hour =LEFT(A2,SEARCH(" ",A2)-1)
For minutes =RIGHT(SUBSTITUTE(A2," minutes",""),2)

Subtracting seconds in Excel

I'm trying to subtract start time from end time to get duration, ie:
1:02 - 0:10 = 0:52
But what I'm getting is:
0:92
I'm using the 0\:00 format. Other suggested formats, such as [mm]:ss, are turning my data into numbers that I don't undestand, ie 1:02 becomes 146880:00
I just want to quickly enter a bunch of times, subtract one col from the other and be done with it.
Does anyone know a way to do that?
Solutions follow an explanation of the results showing in the question.
The format 0\:00 is really the format 000 with a colon character inserted between the first and second digits.
If a cell holds the value 102 and has a format of 0:\00 it will show as 1:02 in the worksheet but behind the scenes its value is still 102. So
1:02 - 0:10 = 102 - 10 = 92 = 0:92 in 0\:00 format
To understand the result with the [mm]:ss format, you need to understand how dates (and time) values are represented in Excel. There is a reasonable explanation on this webpage from Chip Pearson
First, as a date/time value 102 is equivalent to 0:00 on 11 April, 1900 as it is 102 days from Excel's day/time zero. Second, the format [mm]:ss expresses this elapsed time in minutes and seconds. So
102 days = 102*24*60 minutes = 146880 minutes
which gets displayed as 146880:00 in [mm]:ss format
There are a couple of ways you might resolve your problem.
The first involves entering data differently. A time can be entered directly into the worksheet as hours:minutes:seconds. So 1 minute and 2 seconds can be entered as 0:1:2 (or 00:01:02 or any variant such as 0:01:2 or 00:1:02). This is probably less convenient than just entering 102. By default, numbers entered in this way will display in a hh:mm:ss format but you can suppress the display of hours by changing the format to mm:ss or [mm]:ss. The latter should be used if any of your time values are 60 minutes or more since, the former will suppress the display of hours - for example, entering 0:61:2 (61 minutes and 2 seconds) displays as 01:02 with the former but as 61:02 with the latter.
Note that if you just enter 1:2 rather than 0:1:2 Excel interprets this as 1 hour, 2 minutes and 0 seconds and will display as 02:00 using format mm:ss or as 62:00 using [mm]:ss.
The second way allows you to enter the data as before using the 0\:00 format but requires the use of formulae to convert your entered value into seconds - so, for example, an entered value of 102 is intended to represent 1 minute and 2 seconds, gets correctly displayed as 1:02 but is converted behind the scenes to 62 seconds.
If A1 and B1 contain the entered values the then formula for A1 less B1 is
=(INT(A1/100)*60+A1 - 100*INT(A1/100))-(INT(B1/100)*60+B1 - 100*INT(B1/100))
This formula calculates its result as a number of seconds.
If this result is placed in cell C1 then the formula
=100*INT(C1/60)+(C1-60*INT(C1/60))
converts C1 to a result suitable for displaying with the 0:\00 format
Alternatively, the result in seconds can be converted to days by dividing by 24*60*60 = 86400 and displayed using a time format such as [mm]:ss

AFRACT`s Error Message (#VALUE!) to JON49`s to How do I convert hh:mm:ss.000 to milliseconds in Excel?

Apologies for opening a thread instead of posting comment on the Return-of-the-Archons Thread but i am not allowed to post anything since i do not have 50 reputation. I have the very same problem as AFRACT in How do I convert hh:mm:ss.000 to milliseconds in Excel?
Like probably AFRACT my data is in timestamp: 00:00:00.000 and is generated by a device to measure physiological data (heartrate, EDA, Skin Temp) and i want it to change to total seconds.miliseconds. I tried what JON49 proposed but got the (#VALUE!) Error, and then with timevalue, i got the (NAME!) Error. I have Excel 2016 and I am in Middle Europe (Germany)
A date is simply 1 for every day past 31-Dec-1899. Time is a decimal portion of a day; e.g. today is 42,800 and today at noon is 42,800.5. A true second is 0.0000115740740740741
If you want the seconds as integers with the milliseconds as decimal portion of 1 then multiply your true time value by 86,400 (i.e. 60*60*24) and format the cell as a number with three decimal places; e.g. 0.000.
If you want the time as a true time value then simply use a custom number format of [s].000. In the above image, C1 holds =A1 and is formatted as [s].000.

How can I extract the hour part from a duration value in Excel?

How can I convert duration in excel to text ? I am having 1037:00:00 in a cell, which is the sum of certain durations. I want to extract 1037 alone. Excel returns "hours" when I try to extract with MID or use TEXT function.
If it is really the sum of some durations you can get the amount of hours by multiplying the cell by 24. The internal representation of a date or time cell is the number of days since beginning of the year 1900, so you have to multiply it by 24 to get the number of hours. (The year 1900 is not interesting for you as you just want a time span.) The Hour function does not work here because you get the day hour which is 5 in this case.
Be sure to format your target cell as regular number.
lets assume your cell with 1037:00:00 is in cell L40. You can use the following formula to pull the hours.
=INT(L40)*24+HOURS(L40)
Note this will only pull full hours rounded down. It does not take into account minutes or seconds.
Alternatives:
=Rounddown(L40*24,0)
This alternative is what Fratyx explained in his answer.

Formula to get the worked hours from time A to time B where B is past midnight

I'm using Excel to write down my shifts and get a total of worked hours per day and per week.
I structured it this way:
Everything seemed to work fine until I finished to work at 12.30 am. The result with my formula was -17 hours instead of 7. How can I fix my formula so that it displays a correct amount? I'm using the following formula and I want the result to be displayed in number format, not time.
=IF(C11=0,0,IFERROR(((C11-B11)-D11)*24,0))
What formula can I use?
Excel treats days as 1 for every day past Dec 31, 1899. Today happens to be 42,217. Time is nothing more than a decimal portion of a day. Today at noon was 42,217.5 and tomorrow at 03:00 will be 42,218.125.
Excel also treats boolean (e.g. TRUE/FALSE) values as either 1 or 0 when used in a mathematical equation. e.g. 0.5 + TRUE = 1.5 while 0.5 + FALSE = 0.5.
Test to see if the minuend is less than the subtrahend and if it is, add 1 to it using the result of the test itself.
=(C11+(C11<B11)-B11)*24
      
Finally, it should be mentioned that while you can subtract a larger time from a smaller time to receive a negative decimal value, the negative value cannot be interpreted as time since Excel does not recognize negative time. If you were not multiplying by 24 to retrieve the hours as integers and simply subtracting B11 from C11 the cell would be filled with hashmarks (e.g. ############) to show the error. e.g. 08:00 - 10:00 = (as time) #######.

Resources