将下一个匹配返回到列中的相等值 [英] Returning next match to a equal value in a column
问题描述
我经常需要通过列进行搜索,找到与值的匹配,然后返回相应的值。
我的问题是 INDEX
和 MATCH
始终返回列中的第一个值。
I often need to search through columns to find the match to values and then return the according value.
My issue is that INDEX
and MATCH
always return the first value in the column.
EX。我有7个汽车经销商,这是上个月的销售。奥斯陆和柏林在列 C中列出了相同的价格和
将返回列D的第一个匹配。 INDEX(D:E,MATCH(B1,E:E,0),1))
EX. I got 7 car dealers and this is the sales last month. Oslo and Berlin sold the same ammount and INDEX(D:E,MATCH(B1,E:E,0),1))
in column C
will return the first hit from column D.
A B C D E
rank Sales Delaer
1 409 London | Tokyo 272
2 272 Tokyo | London 409
3 257 Hawaii | oslo 248
4 255 Stockholm | numbai 240
5 248 Oslo | Berlin 248
6 248 Oslo | hawaii 257
7 240 Numbai | Stockholm 255
目前我的最佳解决方案是首先在 B
得到 E
与 MATCH(B1,E:E,0)
并将其添加到新列(列F
)。然后我可以在下一列中添加另一个公式,这是我目前必须做的:
= IF(F2 = F1; MATCH(F2; INDIRECT(F& + F1)):$ F $ 7; 0))+ F2
At the moment my best solution is to first find the row each value in B
got in E
with MATCH(B1,E:E,0)
and add that to a new column (column F
). Then I can add another formula in the next column, which is what I currently have to do:
=IF(F2=F1;MATCH(F2;INDIRECT("F"&(1+F1)):$F$7;0))+F2
有更好的方法吗?
推荐答案
在B2中使用以下标准公式,
In B2 use the following standard formula,
=IFERROR(LARGE(E$2:E$8, ROW(1:1)), "")
根据需要填写
在C2中使用以下标准公式,
In C2 use the following standard formula,
=INDEX(D$2:D$8, AGGREGATE(15, 6, ROW($1:$7)/(E$2:E$8=B2), COUNTIF(B$2:B2, B2)))
根据需要填写
[可选] - 修复列A中的排名。
[Optional] - Repair the ranking in column A.
在A2中使用以下公式,
In A2 use the following formula,
=SUMPRODUCT((B$2:B$8>=B2)/(COUNTIFS(B$2:B$8, B$2:B$8&"")))
根据需要填写
这篇关于将下一个匹配返回到列中的相等值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!