SOLVED

Elapsed time formula

%3CLINGO-SUB%20id%3D%22lingo-sub-1573457%22%20slang%3D%22en-US%22%3EElapsed%20time%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1573457%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%26nbsp%3B%20to%20set%20up%20the%20proper%20formula%20for%20the%20following%20two%20statements%20your%20support%20is%20highly%20appreciated%20i%20attached%20excel%20file%3A-%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1-((check%20If%20cell%20G3%20is%20contain%26nbsp%3B%20Weekend%20or%26nbsp%3BHoliday%20or%26nbsp%3BAnnual%20Leave%20and%26nbsp%3B%20at%20the%20same%20time%20check%20if%20cell%20C3%26nbsp%3B%20contain%20time%20from%2015%3A00%26nbsp%3B%20to%207%3A00%20then%26nbsp%3B%20do%20B3-A3%20)).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(AND(G3%3D%22Weekend%22)%2CB3-A3%2C%20IF(AND(G3%3D%22Holiday%22)%2CB3-A3%2C%20IF(AND(G3%3D%22Annual%20Leave%22)%2C%20B3-A3%2C%20IF(AND(C3%26gt%3B%3D%2215%3A00%22)%2CB3-A3%2C%22B3-C3%22))))*24%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2-((check%20If%20cell%20G3%20is%20not%20contain%26nbsp%3B%20Weekend%20or%26nbsp%3BHoliday%20or%26nbsp%3BAnnual%20Leave%20and%26nbsp%3B%20at%20the%20same%20time%20check%20if%20cell%20C3%26nbsp%3B%20is%20not%20contain%20time%20from%2015%3A00%26nbsp%3B%20to%207%3A00%20then%26nbsp%3B%20do%20B3-C3%20)).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1573457%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1573502%22%20slang%3D%22en-US%22%3ERe%3A%20Elapsed%20time%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1573502%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F752778%22%20target%3D%22_blank%22%3E%40NTCMM%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPerhaps%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIF(((G3%3D%22Weekend%22)%2B(G3%3D%22Annual%20Leave%22)%2B(G3%3D%22Holiday%22))*(MOD(C3%2C1)%26gt%3B%3D7%2F24)*(MOD(C3%2C1)%26lt%3B%3D15%2F24)%2CB3-A3%2CB3-C3)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
New Contributor

 

I'm trying  to set up the proper formula for the following two statements your support is highly appreciated i attached excel file:- 

 

1-((check If cell G3 is contain  Weekend or Holiday or Annual Leave and  at the same time check if cell C3  contain time from 15:00  to 7:00 then  do B3-A3 )).

 

=IF(AND(G3="Weekend"),B3-A3, IF(AND(G3="Holiday"),B3-A3, IF(AND(G3="Annual Leave"), B3-A3, IF(AND(C3>="15:00"),B3-A3,"B3-C3"))))*24

 

2-((check If cell G3 is not contain  Weekend or Holiday or Annual Leave and  at the same time check if cell C3  is not contain time from 15:00  to 7:00 then  do B3-C3 )).

 

5 Replies
best response confirmed by NTCMM (New Contributor)
Solution

@NTCMM 

Perhaps

=IF(((G3="Weekend")+(G3="Annual Leave")+(G3="Holiday"))*(MOD(C3,1)>=7/24)*(MOD(C3,1)<=15/24),B3-A3,B3-C3)
Many thanks Sergei can you explain it for me @Sergei Baklan
i appreciated your replay as my statement
((check If cell G3 is contain Weekend or Holiday or Annual Leave and at the same time check if cell C3 contain time from 15:00 to 7:00 then do B3-A3 )).

in your formula i got for the following dates which the incident time was after or equal 15 should be the formula work in this case as =(B6-A6)*24 (time of escalation - working time) the result 2.9 and by your formula i got 19.4
Working Time Time of Escalation Time of incident
4/20/2020 7:30 4/20/2020 10:24:13 AM 4/19/2020 15:00:00


7<=T>=15 in this time (time of escalation - working time)*24
If the time of incident (T) as the following
15-16-17-18-19-20-21-22-23-00-01-02-03-04-05-06-07
or
3pm-4pm-5pm-6pm-7pm-8pm-9pm-10pm-11pm-12am-1am-2am-3am-4am-5am-6am-7am
Or G3 is contain
Weekend or Holiday or Annual Leave

@NTCMM 

As I understood the logic of your first post

if cell G3 is contain  Weekend or Holiday or Annual Leave
then
   if cell C3  contain time from 15:00:01  to 6:59:59
   then B3-A3
   else <not defined: holiday but working time>
else (cell G3 is NOT contain  Weekend or Holiday or Annual Leave)
   if cell C3  contain time from 7:00  to 15:00
   then B3-C3
   else <not defined: working day but NOT working time>

In the sample (row 6) incident happened on Sunday (perhaps Weekend, but there is no Weekend mentioned) and was escalated on next working day. Perhaps logic shall be different or in G6 it shall be Weekend

image.png

(as well as in first row).

@Sergei Baklan 

 

Yes brother
As your understood the logic is correct
weekend Sat & Fri