引用上一个可见行中的单元格 [英] Reference a cell in the previous visible row
问题描述
如何从过滤范围中引用上一个可见行中同一列中的单元格?
How can I reference a cell in the same column in the previous visible row from a filtered range?
推荐答案
如果我们准备这样做,这很容易.
This is very easy if we prepare to do it.
假设我们有以下数据:
第一步是引入帮助器"列.在 E2 中,我们输入:
The first step is to introduce a "helper" column. In E2 we enter:
=IF(SUBTOTAL(3,A2:A2)=0,MIN($E$1:E1)-1,SUBTOTAL(3,$A$2:$A2))
并复制下来:
现在,关于"helper"列的最酷的事情是,无论如何过滤,它总是显示一个简单的顺序序列.... let对于 Alice
Now the cool thing about the "helper" column is that no matter how you filter it, it always shows a simple sequential sequence....let's filter for Alice
这意味着任何单元格都可以:
This means that any cell can:
- 获取 E 列中的值
- 从中减去 1
- 在 Index()/Match()公式中使用此值来检索上一个可见行中的任何值
- retrieve the value in column E
- subtract 1 from it
- use this value in a Index()/Match() formula to retrieve any value in the previous visible row
EDIT#1:
要回答您的问题,请在 C5 中输入:
To answer your question, in C5 we enter:
=INDEX($C$2:$C$21,MATCH(E5-1,$E$2:$E$21,0))
并且没有过滤器 C5 将显示 $ 391.00
但是在 Alice 过滤器中 C5 将显示 $ 446.00
and with no filtering C5 will display $391.00
But with Alice filtering C5 will display $446.00
这篇关于引用上一个可见行中的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!