uday
Member
Hi experts,
I have figured out one formula to calcute the time (hh:mm) difference between two dates. However it is not giving me the correct answer if the time span is beyond 2 days, it is only working within date or same date,.
Formula correction required:
=IF(B2 <= A2, "Out of Scope", (MIN(TIME(20,0,0), MOD(B2,1)) - MAX(TIME(8,0,0), MOD(A2,1))) + (INT(B2) - INT(A2) - 1) * (TIME(20,0,0) - TIME(8,0,0)) + IF(INT(B2) > INT(A2), MAX(0, TIME(20,0,0) - MAX(TIME(8,0,0), MOD(A2,1))) + MAX(0, MIN(TIME(20,0,0), MOD(B2,1)) - TIME(8,0,0)), 0 ))
Result should be like above mentioned table, however it is not working, beyond 1 day or 2 days span. Sometime the result is not changing.
Also,if required then please suggest what could be the correct format to keep the result.
I have figured out one formula to calcute the time (hh:mm) difference between two dates. However it is not giving me the correct answer if the time span is beyond 2 days, it is only working within date or same date,.
Formula correction required:
=IF(B2 <= A2, "Out of Scope", (MIN(TIME(20,0,0), MOD(B2,1)) - MAX(TIME(8,0,0), MOD(A2,1))) + (INT(B2) - INT(A2) - 1) * (TIME(20,0,0) - TIME(8,0,0)) + IF(INT(B2) > INT(A2), MAX(0, TIME(20,0,0) - MAX(TIME(8,0,0), MOD(A2,1))) + MAX(0, MIN(TIME(20,0,0), MOD(B2,1)) - TIME(8,0,0)), 0 ))
A2 | B2 | Result |
---|
09/08/2024 08:00 AM | 11/08/2024 08:00 PM | 36:00:00 |
09/08/2024 07:00 AM | 11/08/2024 09:00 AM | 37:00:00 |
09/08/2024 07:00 PM | 11/08/2024 09:00 PM | 37:00:00 |
09/08/2024 10:00 AM | 11/08/2024 06:00 PM | 22:00:00 |
09/08/2024 08:00 PM | 12/08/2024 08:00 PM | 48:00:00 |
Result should be like above mentioned table, however it is not working, beyond 1 day or 2 days span. Sometime the result is not changing.
Also,if required then please suggest what could be the correct format to keep the result.