简体   繁体   English

当过滤器处于活动状态时,如何计算 Excel 中的时差?

[英]How do I calculate the Time Difference in Excel when a filter is active?

So i have these data for example:所以我有这些数据,例如:

在此处输入图片说明

as you can see the filter is on "Fahrzeugname".如您所见,过滤器位于“Fahrzeugname”上。 Now i want to calculate the Time Difference of each line.现在我想计算每条线的时差。 If I use如果我使用

=A4-A2

the first line does calculate the right time and if i append that on the next lines it uses:第一行确实计算了正确的时间,如果我将其附加到下一行,它将使用:

=A6-A4

which should be A7应该是A7

Could you help me there?你能帮我吗?

Use the following formula in F2 under "Zeitdifferenz":在“Zeitdifferenz”下的F2使用以下公式:

=LOOKUP(1,1/(D3:D$100=D2),A3:A$100)-A2

You should change the 100 rows reference into whichever you need it to be.您应该将 100 行引用更改为您需要的任何值。 I made this answer under the assumption you always filter for just a single "Fahrzeugname".我在假设您总是只过滤一个“Fahrzeugname”的情况下做出这个答案。 Otherwise, you could create an helper column where you check if a cell is visible in the first place, for example using =SUBTOTAL(3,A2) .否则,您可以创建一个辅助列,在其中首先检查单元格是否可见,例如使用=SUBTOTAL(3,A2) Then you can use the same formula as above but instead of referencing the D-column, you should reference the helper column and check against the value of 1.然后您可以使用与上面相同的公式,但不是引用 D 列,而是应该引用辅助列并检查值 1。

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

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