I am currently facing difficulty to calculate exact hours between In Time and Out time.
for instance :
Column A
Column B
Column C
Column D
1-1-2022
10:00 PM
1-2-2022
6:00 AM
1-2-2022
10:00 PM
1-3-2022
6:00 AM
Now, my problem is that I have to calculate the time from 10:00 PM till 12:00 AM = 2 Hours and rest to be calculated on the next day adding the previous days hours e.g. we have 6 hours from 12:00 AM till 6:00 AM for 1-2-2022 (Column C) and then 2 hours from 10:00 PM to 12:00 AM.
Looking forward your help.
You must add the date and times together, subtracting the In time from the Out time.
Slightly different method:
B2, D2 and E2 formatted as hh:mm
Then you could use mod() like so:
=MOD(D2-B2,1)
I am looking for an excel formula to calculating the number of days from years between "Start date" & "end date"
Example :
My start date is 06/19/2020
My end date is 06/20/2023
I would to know on this example the number of days from year 2020 => from start date ; year 2021 (full year) ; year 2022 (full year) ; 2023 => from end date
Result :
number of days of 2020 : 195
number of days of 2021 : 365
number of days of 2022 : 365
number of days of 2023 : 170
in my databse i have different start date and end date by line to x year
Thanks for your help
You can simply substract one cell value from another, if for example:
A1 = TODAY() (which returns today's date)
A2 = 1/01/2019
B1 = A1-A2 = 765 days
Hope it was helpful for you
You might be interested in the DATEDIF function:
https://stackoverflow.com/a/73268311/13406526
Sorry, but I'm a newbie, cannot add comments.
I am trying to do something as follows:
Date & Time: 27/09/2019 13:28
Working Day: Monday - Friday 8am - 5:30PM (08:00 -> 17:30) (NetworkDays)
Duration: 9.5hrs (09:30 hrs)
Outcome: 30/09/2019 13:28
Logic behind this is
Date & Time + Duration (Only inside the "Working Day") = Outcome
Working Days should only be from Monday - Friday 8am - 5:30pm and excludes weekends. I believe NetworkDays handles this?
If the Date & Time + Duration carries across weekend, then the time carries across to the following Monday.
Is there anything that can handle something like this?
Many thanks in advance
If A1 contains the Date/Time and A2 contains the Duration, then:
=WORKDAY(A1,INT((A1-INT(A1)-8/24+A2/24)/9.5*24))+8/24+MOD(A1-INT(A1)-8/24+A2/24,9.5/24)
I have a request where I am trying to determine if we hit our metrics with tickets opened to our company. Essentially we have to respond to cases within by the next business day, the exception here is if the ticket is opened after Friday 18:00 we get to wait till Tuesday end of day 18:00
So my original thinking was if a ticket:
1) a ticket is not opened, Fri, Sat, Sun then if response time is less than 24 then we MET
2) a ticket is opened up after 18:00 Friday then we have till EOD Tuesday 18:00 - it does not matter what time within Friday 18:00 to Sunday 23:59.
3) If a ticket is opened up Friday 00:00-117:59 then we have until Monday 18:00
Problem is I don't know how to calculate what the time should be, in a perfect situation a case is opened on Friday 17:00 and we have exactly 72 hours to respond. But cases are opened anytime throughout the weekend and how do I subtract that from the 72 to determine if we met or not.
Here is an example of my table
Month Year Day Time Hours Met/Miss
January 2017 Wed 15:20 19.77
January 2017 Tue 9:02 2.04
January 2017 Tue 11:35 0
January 2017 Fri 10:37 0.19
January 2017 Fri 17:48 89.06
January 2017 Mon 0:33 0.03
Any suggestions, I am also going to wrap this into VBA so that a macro does all this work.
Should know that I am only a beginner-intermediate in Excel and VBA - sorry
You're going to be better off if you can input your ticket open time as a date, then use a VBA function to calculate a due date. Then you can either calculate a ticket closed date and compare, or calculate a time difference and compare. Hypotheically you don't actually need your day of month because you only care about day of week, but it would be best to include day of month as shown below.
Edit
The same functionality of the VBA function below can be achieved by the worksheet equation:
=IF(WORKDAY(WORKDAY(H2,1,Holidays),-1,Holidays) = ROUNDDOWN(H2,0), WORKDAY(H2,IF(HOUR(H2)>=18,2,1),Holidays)+18/24, WORKDAY(WORKDAY(H2,-1,Holidays),2,Holidays) + 18/24)
Where the H column has ticket opened dates and Hol is your list of holidays.
It may or may not be easier/better to use this VBA function which basically does the same thing without holidays. The VBA function can be friendlier to future programming.
Function CalculateDueTime(OpenedTime As Date)
Dim DueTime As Date
Dim wkd As Integer
wkd = Weekday(OpenedTime, vbSunday)
If wkd = 1 Then
'Zero the hours, Add 2 days to get from Sunday to Tuesday, then get to 18:00
DueTime = DateAdd("h", 18, DateAdd("d", 2, DateAdd("h", -Hour(OpenedTime), OpenedTime)))
ElseIf wkd = 7 Then
'Zero the hours, Add 3 days to get from Saturday to Tuesday, then get to 18:00
DueTime = DateAdd("h", 18, DateAdd("d", 3, DateAdd("h", -Hour(OpenedTime), OpenedTime)))
Else
'Add an hours portion to see what day we arrive at
'The reason this works is because what you actually have is an offset in your end-of-day from midnight to EOB.
'So we're accounting for that offset by adding 6 hours then adding 24 to get to our due day,
'then defining 18:00 as our due time on that due day.
DueTime = DateAdd("h", 6 + 24, OpenedTime)
'Whatever day we arrived at above, zero the hours and add 18
DueTime = DateAdd("h", 18, DateAdd("h", -Hour(DueTime), DueTime))
wkd = Weekday(DueTime, vbSunday)
If wkd = 7 Or wkd = 1 Then
'If our due date lands on the weekend
'we can always resolve it by adding 2 days
'Opened Thur due Sat becomes due Mon
'Opened Friday due Sat becomes due Mon
'Opened Friday due Sunday becomes due Tues
DueTime = DateAdd("d", 2, DueTime)
End If
End If
CalculateDueTime = DueTime
End Function
This gives the the following results...
It doesn't really matter, but if you're curious about the date formatting here is the custom format I used.
I want to calculate the time difference between two dates with the following criteria:
1) excluding sundays and public holidays
2) TIMING: Mon to Fri = 7 AM to 7 PM &
Sat = 7 AM to 3 PM
I tried a many formulas and nothing works for me.
please any ideas??
Eg: Start Time: 3/6/2015 10:00 AM
End Time: 4/6/2015 12:00 PM
Then I should get the difference as 13 hrs (excluding time out of business hours)
If start and end "timestamps" will always be within working hours then you can use a formula like this:
=(SUM(NETWORKDAYS.INTL(A2,B2,{1,"1111101"},H$2:H$10)*{12,8})-IF(WEEKDAY(B2)=7,8,12))/24+MOD(B2,1)-MOD(A2,1)
Assuming start date/time in A2, end date/time in B2 and holiday list in H2:H10
Format result cell as [h]:mm and if start time is today (Monday) at 14:00 and end time is exactly a week later you will get the result 68:00 (5*12 hour days and 1*8 hour Saturday)