SUM interval of rows even if error - excel

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.

Related

EXCEL: what is the formula for getting the time remaining until tonight 00:00

I have a list of date and time, say 3/5/2018 15:00:00
I want a formula to calculate the time remaining until tonight 00:00
for this example, it should be 09:00:00
this is an image of the resulting table I wanted
what i tried: =TEXT(TIME(24,0,0)-A20, "hh:mm") the result is #Value!
The general algorithm for this, in any programming language or environment is simple:
Get the date component from the date-time value.
Increment the day value.
Subtract the date-time value from the date value in step 2
This works because the value from step 2 is still a date-time value, but the time-of-day component is now zero which represents that day's morning-midnight (i.e. 00:00 in the 24-hour clock).
In Excel, date, time, and date-time values are all represented by decimal numbers where the integer component represents a day-count after some epoch and fractional component represents the time-of-day.
This means step 1 is done by simply doing INT( date-time-value ).
And step 2 is done by simply adding +1 to that value.
And step 3 is simple subtraction, but be sure to set the cell's display format to "Time" and not Date or Date-Time.
Cell B2 should have this formula:
=( INT( A2 ) + 1 ) - A2
Then drag-fill that for the column to get the values for the other rows.
That's it.
So, did this, do note that my answer is in decimals... You can sort to hours, minutes and seconds...
=24-(HOUR(B4)+MINUTE(B4)/60+SECOND(B4)/3600)
This should do:
=24-TEXT(A20,"hh:mm")
Considering midnight is either 0 or 24, depending on where you come from, as we are moving towards it we consider as "24" and when we are moving from it, "0". So I subtract the current time/date in a format that excludes the date from "24" and there you have remaining time to midnight.
Do not forget to format the cell to "time", otherwise the results will be wrong.

How do I calculate this time? Across midnight

I have a sheet with start and end dates and values.
In C I have start date.
In E I have end date.
In I I have start time. (06:05:00)
In J I have end time. (08:33:00)
If C <>E I need to add 24 hours to the time elapsed.
How can I do that?
I tried if(C2<>E2;1+J2-I2;"omitted")
But I get the result 21:32:00.
It should be about 26 hours
(24+8-6 = 26 if we only look at the hours).
What have I done wrong?
Edit;
Back at work and can now upload some images.
Method 1
Method 2
Both return the wrong time.
EDIT2;
Method 3
I remember how I always have to format the dates from "our" format to Excels format for it to be recognized as a date.
In column P I use RIGHT(), MID(), and LEFT() to make a correct formatted date.
In R and S I use the same as P&Q column.
Still not correct.
:-/
EDIT again:
Use formula: =(E1+J1)-(C1+I1) we just add the date and time together and subtract the end from start and then format the cell having the formula to show days, hours, minutes.
This way, if you have more than 1 day difference, you're not just adding 24 hours.
Change the format of the target cell contianing the above formula to
d "days" hh "hours" mm "minutes"
or use the format tigerAvatar suggested of [hh]:mm if you want the hours to be cumulative across days.
Then you get a nice output of: 2 days 02 hours 28 minutes or 50:28
Feel free to drop the 1 h or 1 m if you don't want the leading zeros.
A picture is worth a 1000 words so:
Version 2 after your screenshots: I don't think C, E are in date format based on your updates so...
I used formula=(DATE(LEFT(E2,4),MID(E2,5,2),RIGHT(E2,2))+J2)-(DATE(LEFT(C2,4),MID(C2,5,2),RIGHT(C2,2))+I2) in K and custom format mask: [h]:mm
If this doesn't work it may be a regional setting and the interpretation of [h]:mm I am assuming I/J are time formats.

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.

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.

how to convert decimal time to hh:mm time format in excel

I have looked at all the options I can find on this forum, but I am unable to solve my problem. this may very well be because I only have basic excel skills. simple question..how do I convert a decimal time ie 9.25 into hh:mm format ie 09:25 ? I need to do this as I am using existing data that requires rounding to 15 mins + 2mins and I can only do this in hh:mm format. Many thanks
Assuming your value is in A1...
Get the hours
=FLOOR(A1, 1)
Get the decimal portion
=A1 - FLOOR(A1, 1)
Convert this decimal to minutes (0.25->25):
=(A1 - FLOOR(A1, 1)) * 100
Bring the whole lot together:
=TIME(Floor(A1, 1), (A1 - FLOOR(A1, 1)) * 100, 0)
Result: 9:25 AM
If it's a true decimal time then 9.25 hours should convert to 9:15. If that's the case you can just divide by 24, e.g. 9.25 in A1 then in B1
=A1/24
format B1 as [h]:mm and you'll get 9:15
....and if you really do want 9:25 as the answer you could try this formula
=TEXT(A1*100,"00\:00")+0
format result cell as [h]:mm- that will work even for values > 24
If you want you can do your conversion and rounding in one go, e.g. to round to the nearest 15 minutes the first formula becomes:
=MROUND(A1/24,"0:15")
Let's suppose you have 9.25 in cell A1. First you need to extract the integer part (9). Let's put this in B1:
=FLOOR(A1)
Now we must get the decimal part:
=A1-B1
And convert it into the ratio-to-60, so let's have this in C1:
=(A1-B1)/0.6
This way, 0.25 becomes 0.4166... (Of course 0.30 would become 0.50).
Finally, add both values and divide by 24. In Excel, dates/times are stores as decimal numbers in which 1 = 24 hours. So let's place this in D1:
=(B1+C1)/24
The result is 0.392... And if you give that cell a time format, you will see 09:25.
So, now let's put all together in one cell:
=(FLOOR(A1)+(A1-FLOOR(A1))/0.6)/24
Don't forget to format the cell as time (custom format "hh:mm", for example).

Resources