简体   繁体   English

具有多个条件的复杂公式

[英]Complex Formula with Multiple Conditions

I have to work out how much time the client has spent out of the system.我必须计算出客户在系统之外花费了多少时间。 The rules are I need to use the logout time and subtract it from the next logon time to work out the system out time.规则是我需要使用注销时间并从下一次登录时间中减去它来计算系统退出时间。 The 1st logon of the day has no system out time and the next day it is all reset.当天第一次登录没有系统超时时间,第二天全部重置。 I am not sure if I can get a formula to cover all these scenarios.我不确定我是否能得到一个公式来涵盖所有这些情况。

The formula of C2-0 for row 1 and B3-C2 for Row 2 work for the 1st 2 rows then you get a new client.第 1 行的 C2-0 和第 2 行的 B3-C2 公式适用于第 1 2 行,然后您将获得一个新客户。 Then the next day it system out time gets reset and you need to work it out again for the next day like row 1 and 2.然后第二天系统超时时间被重置,您需要在第二天再次计算,如第 1 行和第 2 行。

在此处输入图片说明

Here is an example:下面是一个例子:

在此处输入图片说明

Formula in F2 : F2公式:

=IF(SUMPRODUCT((TEXT($B$1:B1,"dd-mm-jjjj")=TEXT(B2,"dd-mm-jjjj"))*($A$1:A1=A2))>0,B2-INDEX($C$1:$C$6,MATCH(1,($A$1:A1=A2)*(TEXT($B$1:B1,"dd-mm-jjjj")=TEXT(B2,"dd-mm-jjjj")),0)),0)

Entered as array through Ctrl + Shift + Enter通过Ctrl + Shift + Enter作为数组输入

Drag down...拖累...

Note: Change text format to your liking, mine is in Dutch hence why I used "dd-mm-jjjj"注意:根据自己的喜好更改文本格式,我的是荷兰语,因此我使用“dd-mm-jjjj”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM