使用Excel进行首次上次和上次超时

时间:2016-10-10 21:15:38

标签: excel excel-formula excel-2013

我在下面有一个数据,我想获得唯一的ID号码,只有第一次进入和上次出现。数据看起来像这样:

enter image description here

结果应该是这样的:

enter image description here

1 个答案:

答案 0 :(得分:1)

由于您的时间是文本,看起来像我们需要转换它们的时间。

我们可以使用两个嵌套的SUBSTITUTES在公式中执行此操作。

要获得MIN和MAX,我们将使用AGGREGATE公式。

MIN:

=AGGREGATE(15,6,SUBSTITUTE(SUBSTITUTE($D$2:$D$7,"AM"," AM"),"PM"," PM")/($A$2:$A$7=A12),1)

MAX:

=AGGREGATE(14,6,SUBSTITUTE(SUBSTITUTE($F$2:$F$7,"AM"," AM"),"PM"," PM")/($A$2:$A$7=A12),1)

enter image description here

您可以对数组公式MIN(IF())和MAX(IF())执行相同的操作。

=MIN(IF($A$2:$A$7=A12,--SUBSTITUTE(SUBSTITUTE($D$2:$D$7,"AM"," AM"),"PM"," PM")))
=MAX(IF($A$2:$A$7=A12,--SUBSTITUTE(SUBSTITUTE($F$2:$F$7,"AM"," AM"),"PM"," PM")))

由于它们是数组公式,因此在退出编辑模式时需要使用Ctrl-Shift-Enter而不是Enter来确认。如果操作正确,Excel会将{}放在公式周围。

两组公式都将返回小数。需要将单元格格式化为正确的所需输出。