Time format in Excel is getting messed up - excel

I wrote 955:00:00 for 955 hours in excel however, it is getting stored as 08-02-1900 19:00:00 when I run hours() function on it then it gives me 19. I am not able to make sense of why this is happening.

Excel stores all date/time values as the number of days since 31/12/1899. Any times over 24 hours are treated as being a day. You can simply format the cell as [hh]:mm:ss if you want to see hours over 24. For calculations, simply multiply the cell value by 24.

Related

Time Study in Excel

I am completing a time study and recording time in excel. I have numbers like 2.24, etc.. I am trying to add them and average them and I am getting numbers like 9.76 when I really want 10m and 16seconds. Any thoughts to fixing this?
When I change the format to mm:ss it give me wild answers
If 9.76 is a decimal number and it's is in A1, then in B1 you can use:
=((A1-(ROUNDOWN(A1;0)))/0,6+(ROUNDOWN(A1;0)))/24
Also, format of cell with formula must be hours (I've used [hh]:mm:ss)
Applying this, I get:
I've done it in the following way: I used cell formatting, like u:mm:ss (in English locale, this might be h:mm:ss instead).
In one cell, I've put 0:2:24 (zero hours, two minutes, 24 seconds).
In the cell below, I've put 0:7:52.
Adding both cells (inside a cell with the mentioned cell formatting) yielded 0:10:16.
=9.76 value(minutes)
=24*60 number of minutes in a day
=A1/A2 formatted as time
Will show 12:09:46. You can use =MINUTE(A3) to extract the minutes and =SECOND(A3) for the seconds.
Actually if 9.76 means 9 minutes and 76 seconds, you'll need more formulas to extract the minutes and seconds then add them together. You can use =Floor() to get the integer. Subtract to find the .76 and multiply by 100 to get the number of seconds. Then divide by 60 to convert to minutes and add to the 9 whole mins. Now you have the number of mins which you can convert to a time value per the above.
EDIT:
You need to enter in Excel as 0:02:12 then you can add quite nicely. If you don't want to re-enter everything you can do this: =VALUE("0:"&SUBSTITUTE(A1,".",":")) then add. Be sure to convert each individual value BEFORE adding otherwise you might get incorrect results.

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 works fine with the cell in hh:mm:ss format, but the same formula gives incorrect value in cell with mm:ss format

my data appears as this
WAIT
29:45:00
2:41:14
46:06:00 ' <---
0:25
19:23 ' <---
2:25:12
37:36:00
2:12:24
1:34:35
1:54:13
13:00:53
when i am applying the formula =HOUR(F7)*3600+MINUTE(F7)*60+SECOND(F7) to 46:06:00, it gives the correct answer, however when same formula is applied to the 19:23, excel recognizes 19:23 in HHMMSS format, however it is MMSS...
i have a huge data base and it would be very difficult for me to change it manually....
please help...
By default, Excel treats numbers in the format xx:xx or x:xx as h:mm, and NEVER as mm:ss.
I don't see a way to transform the values into valid hh:mm:ss, since there is no handle for Excel to determine which number is lacking the hour part.
The best option is to change the routine that writes the data and have the hour entered as 00: before a mm:ss value.
As long as the data column is formatted as text, you could test how many colons exist in the string and apply a different calculation depending on whether there is 1 or 2. If there is only 1 colon, then use what Excel thinks is the hours as the minutes, and what Excel thinks are the minutes as the seconds.
=IF(LEN(F7)-LEN(SUBSTITUTE(F7,":",""))=2,HOUR(F7)*3600+MINUTE(F7)*60+SECOND(F7),HOUR(F7)*60+MINUTE(F7))
It's difficult to tell whether your data is text-formatted or not - HOUR/MINUTE/SECOND functions work just as well on text-formatted times as real times. What result do you get with this formula?
=ISNUMBER(F7)
If that gives you FALSE then your "times" are text formatted in which case this formula will give you the total seconds:
=LOOKUP(999,({"","0:"}&F7)+0)*86400
format result cell as general
That will interpret 19:23 as 19 minutes 23 seconds as required. For 46:06:00 you will get the result 165960, the total seconds in 46 hours and 6 minutes. Your formula is giving you just the seconds from the remainder after multiples of 24 hours are removed, as pnuts points out. That's because
=HOUR("46:06:00")=22
If you want the result to be 79560 then you can add a MOD function like this:
=MOD(LOOKUP(999,({"","0:"}&F7)+0),1)*86400
The LOOKUP function works here because it exploits the fact that concatenating "0:" to the start of 19:23 (and then doing a calculation like +0) converts 19:23 (19 hours 23 minutes) to 0:19:23 (zero hours, 19 minutes, 23 seconds) but concatenating 0: to 46:06:00 and then adding 0 gives you an error.
Guyz, thx for answering the question..
here is what i tried-
first i applied
=TEXT(D2,"hh:mm:ss") formula to the cell value and then used =IFERROR(SUMPRODUCT(("00:"&d2)+0),d2), so 19:23 got changed to 00:19:23..
It worked though i had to do some manual work on the data...

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

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

Basic excel date and time problem

Have a list of dates in excel in the format (this comes originally from csv):
23/11/09 07:27:02
23/11/09 08:01:50
23/11/09 08:38:58
23/11/09 09:40:01
What I want to do is count the number of these falling between hour blocks, like 7-8, 8-9, 9-10 etc
Not sure how to get started, but one idea was just to put logic statements comparing the dates between these blocks, then adding the total "trues"
I can't get it to compare properly. When I type it the hour block marks,
e.g. 23/11/09 08:00
excel actually shows that as
23/11/2009 8:00:00 AM
and the compare doesn't work. Well actually it does the opposite of what it should.
that is:
=IF(C5>L1,IF(C5<M1,TRUE,FALSE),FALSE)
C5 being date in top codeblock, L1 and M1 being the hour blocks I manually entered in the second code block.
Has anyone got any ideas?
=hour(a1)=7
will return true if the time of the date/time value in cell A1 is between 7 and 8 (AM) and will otherwise return false.
Excel stores dates as number of days since 1900 or 1904 depending on your setting and the time as a fraction of the days. So 11:59 am 4th of July 1960 is held internally as '22101.4993055556'.
As such you cannot do plain charactrer string comparisons on dates. However ther ar lots of nifty time/date functions available to you.
You probably want :
=IF(HOUR(B1) > 8,IF(HOUR(B1)<12,"YES","NO"),"NO")
You should use Excel functions, like HOUR(), to extract the parts of the times, and apply the logic tests to those extracted values.

Resources