Converting a raw number to a timestamp in Excel - excel

I have a set of numbers ranging from 390 up to 999 in increments of 1. These numbers correspond to timestamps, so 390 corresponds to 6:30am (the 390th minute of the day is 6:30am), 391 corresponds to 6:31am, and so on. Is there a simple formula in excel that could convert these numbers to timestamps for me? I have the first column, Time ID, and I'm wanting to calculate the second column, Time.
Time ID Time
390 6:30:00 AM
391 6:31:00 AM
392 6:30:02 AM

Assuming your data starts in Row 2:
=A2/(24*60)
or
=TIME(0,A2,0)
To force the format, wrap either of the above with TEXT([formula], "hh:mm:ss am/pm")
(Shamelessly stolen from the Great #ScottCraner's comments here)

you can divide by 1440 and then format the cell as time

Related

Converting Excel Date/Time to 24-hour with missing characters

I received a sheet with thousands of records where the date/time records are incorrect. Some of the time format is missing a leading zero, and I need to trim off the AM/PM and seconds places. Time time needs to be in 24-hour (military) time. Ex:
10/8/2016 80000 AM
Should be: 2016-10-08 08:00 (yyyy-mm-dd hh:mm)
Some of the other records have the correct amount of characters. Ex:
10/8/2016 120000 PM
Should be: 2016-10-08 12:00 (yyyy-mm-dd hh:mm)
Therefore, I can just trim the PM and seconds from the right.
General rule: If the number begins with a 1 it is likely a time between 10:00 and 19:59, if the number begins with a 2 - 9 likely just add a 0 in front and making it 02:00 through 09:59.
My challenge is finding a formula that will accomplish all of this so I don't have to wade through thousands of records to fix the time.
I suspect that you have already figured this out but here is one approach (just because I found it interesting)
So column A holds the actual value
Column C has the following formula to extract the date (presumption here is that first part of the string in column A is a date):
=TEXT(LEFT(A2,FIND(" ", A2, 1)-1), "yyyy-mm-dd")
Column D extracts the time string from column A:
=LEFT(RIGHT(A2,LEN(A2)-SEARCH(" ",A2)),SEARCH(" ", RIGHT(A2,LEN(A2)-SEARCH(" ",A2)))-1)
Now to convert the value in column D to a 24hour time format (without the :) based on AM or PM in column A. So column E is:
=IF(UPPER(RIGHT(TRIM(A2),2))="PM",IF(LEFT(TRIM(D2),1)="1",12+INT(LEFT(D2,2)),12+INT(LEFT(D2,1)))&RIGHT(TRIM(D2),4), D2)
All that is left is to create the required string.. that's where column F comes in:
=C2& " "&IF(LEN(E2)=5,"0"&LEFT(E2,1),LEFT(E2,2))&":"&IF(LEN(E2)=5,MID(E2, 2,2),MID(E2, 3,2))
Not sure if this is the best approach but first one that came to my head :)

Find a temperature and work out how long it remained >= this temperature

I have an excel sheet with times in one column and temperatures in another. I'm trying to work out a formula that will find a certain temperature and measure how long it remained at that temperature.
11:25:29 AM 69.3°C
11:26:29 AM 69.6°C
11:27:29 AM 69.8°C
11:28:29 AM 70.0°C
11:29:29 AM 70.2°C
11:35:29 AM 70.8°C
11:36:29 AM 70.3°C
11:37:29 AM 69.5°C
11:38:29 AM 68.5°C
11:39:29 AM 67.5°C
12:39:29 PM 66.3°C
1:39:29 PM 52.1°C
2:39:29 PM 12.1°C
3:39:29 PM 5.0°C
In this example, I would like to find when it hit 70.0°C and how long it stayed above 70.0°C.
This is a bit of a tough problem because you might have multiple occasions where you go above 70 degrees. In that case, do you want the total time spent above 70 in the entire dataset, or do you want the total time spent above 70 consecutively? And then, how are you determining which of these potential multiple nonconsecutive periods you are talking about?
That said, you can try this. If column A is your datetime, and column B is your temp reading, specify another cell as your temperature reference value ($D$1 here), and in column C starting in row 2 do this:
=(A2-A1)*IF(B2>=$D$1,1,0)
and then copy that all the way down. What that does is it calculates the time difference between measurements and then if the temperature at that time is greater than your reference, it multiplies it by 1, otherwise it multiplies by 0. Because a date/time in Excel is really just a number, what you get is an interval of a day between measurements in each cell of column C. In other words, .25 = 6 hours.
Now that you have that data in column C, you are free to further parse it. You can use a simple SUM(C:C) formula in a cell, or you can go back and sum up individual ranges. I hope this helps.

SUM interval of rows even if error

i'm trying to sum values but when a cell as an error, id like that to count as a 0, and continue adding.
the values in the cells are 15:60, or 8:00, "h:mm"
i've tried this:
{=SUM(IF(ISERROR(A1:A7);0;A1:A7))}
but it gives me a weird value
example:
15:00
06:00
gives me 0,875?
i just want it to add, 15:30 + 15:30, should give 31:00
thx in advance!
[SOLVED] change the cell type to TIME 37:30:55
21/24 = 0.875
The result is 21:00 but in float number, the normal way for Excel to store time.
The same with date times, they are also stored that way.
Integer (whole numbers) as the number of days since 1/1/1900 and the fraction as the time.
Most likely all you need to do is to change the format of the cell to time and it will be displayed correct.

Adding/Subtracting Whole numbers from Time

I have tried every which way to format cells to subtract the result from time for instance the formula in the cell = 11(this is 11 minutes) I want to take that result minus 8:00:00 to give me 7:49:00 but it doesn't work the result is ####### no matter how big I make the cell. And if I format the cells with the formula to custom [m]:ss then the value changes.
Sample of the Worksheet:
I want Y2 = X3-W3 in a time format.
So, if A1=11
Then in some other cell, (B1 in this example): =TIME(,A1,)
Then subtract from the cell with 8:00:00. (If it's C1...:)
=C1-B1
That will give you the time you want.
Info: The main thing is that you have to tell Excel that your cell with the "11" in it, is minutes. By using the =TIME(,A1,) you will get the value of: 12:11 am. (If you keep it in Date format.) 12:11 am could also be viewed as: 0 Hours, 11 minutes, 0 seconds. And now that it knows, you should be able to subtract.
Try this:
=TIME(HOUR(X3),MINUTE(X3)-W3,SECOND(X3))
The ######### is because you have a negative time. Becuase Excel reads time as decimals of 24 hours, 8:00:00 is .3333 and if you subtract 11 from that you get -10.6666 and date/time can not be negative.

Excel 2013: Convert Hours and Minutes from hh:mm:ss formatted cell in decimal number

I use Excel 2013 and have a cell with the following value:
"08.01.1900 1:45:00"
that will be displayed inside the cell as: "193:45:00" - meaning 193 hours, 45 minutes and 00 seconds (see the first image below).
Here is screen of how it looks like and the formatting of the cell
[how it looks like]
QUESTION: How I can in cell "Salary" to get decimal number, like - 193,45? Help me, please.
The cell is formatted as Time (see the image below)
So, you have Q2 = 12:30 (or 12,5 hours where 0,5 hour=30min) and R2 = 15,5 UAH/hour and since you want to calculate salary, you should multiple 12,5*15,5=193,75.
Follow next steps to achieve the desired result:
Write next formula in S2: =Q2*24*R2 (since time stored in Excel as part of a day, we need to multimply by 24 . Your value 12:30 is actually 0,520833333333333 ,you can see it if you'd format Q2 as number. Myltiplication 0,520833333333333 by 24 gives you exactly 12,5)
Format your S2 as number
the result would be 0,52*24*15,5 = 193,75 and this value is what you actually need.

Resources