MS Excel:公式无法正常工作
我是Excel的新手。 我正在尝试做出勤报告。现在,报告将根据以下条件进行计算:
Min Range as 'C': 09:30 Max Range as 'D': 19:30
让我们考虑一下,A为In,B为Out
a)If A>C and B<D, then BA For Eg: 10:00>09:30 and 19:00<19:30 then O/P is 09:00 b)If A<C and B<D ,then BC For Eg: 09:00<09:30 and 19:00<19:30 then O/P is 09:30 c)If A>C and B>D, then DA For Eg: 10:30>09:30 and 20:00>19:30 then O/P is 08:00 d)If A<C and B>D, then DC For Eg: 09:00<09:30 and 20:00>19:30 then O/P is 10:00
Excel公式:
=IF(AND(B>=C,A<=D),BA, IF(AND(A>=C,B>=D),H55-A, IF(AND(A<=C,B<=D),B-H54, IF(AND(A<=C,B>=D),"10:00","Wrong"))))
现在,Excel公式正在为某些条件而工作,但是对于某些条件不起作用。 请build议我。提前感谢。
看一下这个。
=IF(AND(A>=C,B<=D),BA,IF(AND(A<=C,B<=D),BC,IF(AND(A>=C,B>=D),DA,IF(AND(A<=C,B>=D),DC,"Wrong"))))
所描述的标准可以总结如下:
In Time
不能早于09:30
, Out Time
不能晚于19:30
。
因此In Time = IF(A<=C,C,A)
和Out Time =IF(B>=D,D,B)
最后的公式应该是O/P = Out Time - In Time
然后试试这个公式:
=SUM(IF(B>=D,D,B),-IF(A<=C,C,A))