How can I reference a cell in the same column in the previous visible row from a filtered range?
如何从过滤范围中引用上一个可见行中同一列中的单元格?
1 个解决方案
#1
4
This is very easy if we prepare to do it.
如果我们准备这样做,这很容易。
Say we have data like:
假设我们有以下数据:
The first step is to introduce a "helper" column. In E2 we enter:
第一步是引入“帮助”列。在E2中我们输入:
=IF(SUBTOTAL(3,A2:A2)=0,MIN($E$1:E1)-1,SUBTOTAL(3,$A$2:$A2))
and copy down:
并复制下来:
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:
这意味着任何细胞都可以:
- retrieve the value in column E
- 检索E列中的值
- subtract 1 from it
- 从中减去1
- use this value in a Index()/Match() formula to retrieve any value in the previous visible row
- 在Index()/ Match()公式中使用此值可以检索上一个可见行中的任何值
EDIT#1:
编辑#1:
To answer your question, in C5 we enter:
要回答您的问题,请在C5中输入:
=INDEX($C$2:$C$21,MATCH(E5-1,$E$2:$E$21,0))
and with no filtering C5 will display $391.00
But with Alice filtering C5 will display $446.00
并且没有过滤C5将显示$ 391.00但是使用Alice过滤C5将显示$ 446.00
#1
4
This is very easy if we prepare to do it.
如果我们准备这样做,这很容易。
Say we have data like:
假设我们有以下数据:
The first step is to introduce a "helper" column. In E2 we enter:
第一步是引入“帮助”列。在E2中我们输入:
=IF(SUBTOTAL(3,A2:A2)=0,MIN($E$1:E1)-1,SUBTOTAL(3,$A$2:$A2))
and copy down:
并复制下来:
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:
这意味着任何细胞都可以:
- retrieve the value in column E
- 检索E列中的值
- subtract 1 from it
- 从中减去1
- use this value in a Index()/Match() formula to retrieve any value in the previous visible row
- 在Index()/ Match()公式中使用此值可以检索上一个可见行中的任何值
EDIT#1:
编辑#1:
To answer your question, in C5 we enter:
要回答您的问题,请在C5中输入:
=INDEX($C$2:$C$21,MATCH(E5-1,$E$2:$E$21,0))
and with no filtering C5 will display $391.00
But with Alice filtering C5 will display $446.00
并且没有过滤C5将显示$ 391.00但是使用Alice过滤C5将显示$ 446.00