Sep 13 2020 04:12 PM
I have a sheet that receives all the inputs for our production including time started and time finished.
The times inserted can be from one day to the next. I have not been able to subtract the times with the dates. I need for it to calculate the time difference between an evening time to the next day evening time or morning time or whatever it might be. I tried INT also and made sure the PM and AM were a part of the data and formatted cells.
Sep 13 2020 06:31 PM
@Sockens It is hard to know what the problem is without seeing it. My suspicion is that there isn't a problem with the formula but in what you are expecting to get and what you are seeing. If you subtract 2020-09-11 5:00pm from 2020-09-12 11:00pm you might expect 18:00 hrs but see 1.25 instead. In excel dates are represented based on days so 1.25 means 1 1/4 days or 1 day 6 hrs. There are ways to force excel to display using a particular number (or date or time) format but you haven't really explained what you need to see and what you are seeing. Maybe include a sample sheet?
Sep 13 2020 09:13 PM
@Sockens I suspect you are looking at L21. You probably have the formula =L19-L17 there and you want to see 27:00 hours. In stead, you get 3:00. When you subtract dates and times, Excel defaults to a time format. Time can be presented from 00:00 up to 23:59 (=24 hours = 1 day). After that, time starts from 00:00 again. Hence, 27 hours becomes 3:00 , unless you explicitly tell Excel to continue adding hours. Time then becomes Duration. Use custom formatting like [h]:mm to display 27:00.
Sep 14 2020 06:52 AM
@mtarlerI sent a file with the message. But here is a sample file with the two sheets.
Sep 14 2020 07:24 AM
Sep 14 2020 07:32 AM
Sep 14 2020 10:23 AM
Sep 14 2020 10:31 PM
@Sockens Since you already have the dates in your schedule in C1 and D1, why not simply use
=(D1+D5)-(C1+C4)
and custom format as [h]:mm, just to be sure to calculate duration in stead of time. Result will be 15:10
Sep 14 2020 11:53 PM
SolutionI agree with @Riny_van_Eekelen
The safest option is to include the dates in the calculation of elapsed time
= (endDate+endTime) - (startDate+startTime)
= MOD(endTime -startTime, 1)
The second option is only usable if you are certain the elapsed time will never exceed 24hrs.
The number format you require is [h]:mm unless you choose to multiply by 24 and output the result as decimal hours, in which case it would be 0.0 "hours" .
The ranges defined for your dried weight calculations are incorrect and include the total itself, so giving rise to circular references.
Sep 15 2020 07:02 AM
I saw your comment at the bottom and went in and checked, do not know how that happened, I know better then to do that and also didn't check that either because wouldn't have know it had executed it like that. Made changes and it works. Thank you.
For the time, you are saying your equation will work if the time is more than 24 hours. Which I have an occasional fruit that does go over 24 hours.
Thank you.
Sep 14 2020 11:53 PM
SolutionI agree with @Riny_van_Eekelen
The safest option is to include the dates in the calculation of elapsed time
= (endDate+endTime) - (startDate+startTime)
= MOD(endTime -startTime, 1)
The second option is only usable if you are certain the elapsed time will never exceed 24hrs.
The number format you require is [h]:mm unless you choose to multiply by 24 and output the result as decimal hours, in which case it would be 0.0 "hours" .
The ranges defined for your dried weight calculations are incorrect and include the total itself, so giving rise to circular references.