考虑这个示例 Excel 表:
A B C
| Time | Action |
| 1 | Adam arrives |
| 2 | Adam leaves |
| 3 | Berta arrives |
| 4 | Berta says: Huhu! |
| 5 | Berta leaves | ?
| 6 | Caesar arrives |
| 7 | Doris arrives |
| 8 | Caesar says: Have you recently seen Brutus, Doris? |
| 9 | Adam arrives |
| 10 | Doris says: No! I think he wants to kill you! |
| 11 | Adam leaves | ??
| 12 | Caesar says: I know |
| 13 | Doris leaves | ???
| 14 | Caesar leaves | ????
我想计算人们在聊天中呆了多长时间,并将其显示在 C 列中。让我们排除所有内容,例如如果Bx包含留言则为空和解析留言中的姓名并只关注持续时间计算。为此,在标有?
、和 的??
单元格中,我需要一个类似???
????
在 B2 到 B$currentLine-1 范围内搜索“$person comes”,并返回最后一条结果。有了这些信息,我就能知道时间了。
那可能吗?
答案1
将其放在 C2 中并赋予其适当的单元格编号格式,然后将其拖到列下方。
=IF(RIGHT(B2, 7)=" leaves", A2-AGGREGATE(14, 7, (A$2:A2)/(B$2:B2=SUBSTITUTE(B2, " leaves", " arrives")), 1), "")